Преглед на файлове

Merge branch 'master' of http://git.tjyourong.com.cn/ctop/adsp-boot

zhaoxian преди 3 години
родител
ревизия
ae2e50fffe
променени са 83 файла, в които са добавени 6957 реда и са изтрити 262 реда
  1. 1 0
      jeecg-boot-module-system/src/main/java/org/jeecg/config/ShiroConfig.java
  2. 80 15
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/UserAllocationController.java
  3. 3 3
      jeecg-boot-module-system/src/main/resources/application-dev.yml
  4. 6 6
      jeecg-boot-module-system/src/main/resources/jeecg/jeecg_database.properties
  5. 20 171
      jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java
  6. 10 4
      module-common/src/main/java/cn/com/ctop/common/module/mapper/UserAllocationMapper.java
  7. 42 8
      module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/UserAllocationMapper.xml
  8. 7 1
      module-common/src/main/java/cn/com/ctop/common/module/service/IUserAllocationService.java
  9. 16 0
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/UserAllocationServiceImpl.java
  10. 76 0
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouDimensionCreateJob.java
  11. 5 42
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/BatchController.java
  12. 39 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaiShouAppListController.java
  13. 2 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/KuaiShouVideoGetMapper.java
  14. 1 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouGroupTemplateMapper.xml
  15. 9 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouVideoGetMapper.xml
  16. 2 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaiShouVideoGetService.java
  17. 11 12
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouVideoGetServiceImpl.java
  18. 5 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl.java
  19. 310 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/controller/KuaiShouDimensionAccountController.java
  20. 231 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/controller/KuaiShouDimensionAgeConfigController.java
  21. 241 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/controller/KuaiShouDimensionCampaignController.java
  22. 270 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/controller/KuaiShouDimensionCreativeController.java
  23. 282 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/controller/KuaiShouDimensionMaterialController.java
  24. 227 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/controller/KuaiShouDimensionRegionConfigController.java
  25. 238 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/controller/KuaiShouDimensionRegionDetailController.java
  26. 455 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/controller/KuaiShouDimensionStrategyController.java
  27. 356 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/controller/KuaiShouDimensionUnitController.java
  28. 292 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/controller/KuaiShouDimensionVariableController.java
  29. 90 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/entity/KuaiShouDimensionAccount.java
  30. 63 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/entity/KuaiShouDimensionAgeConfig.java
  31. 81 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/entity/KuaiShouDimensionCampaign.java
  32. 131 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/entity/KuaiShouDimensionCreative.java
  33. 63 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/entity/KuaiShouDimensionMaterial.java
  34. 57 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/entity/KuaiShouDimensionRegionConfig.java
  35. 63 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/entity/KuaiShouDimensionRegionDetail.java
  36. 201 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/entity/KuaiShouDimensionStrategy.java
  37. 277 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/entity/KuaiShouDimensionUnit.java
  38. 93 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/entity/KuaiShouDimensionVariable.java
  39. 19 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/mapper/KuaiShouDimensionAccountMapper.java
  40. 15 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/mapper/KuaiShouDimensionAgeConfigMapper.java
  41. 17 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/mapper/KuaiShouDimensionCampaignMapper.java
  42. 26 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/mapper/KuaiShouDimensionCreativeMapper.java
  43. 25 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/mapper/KuaiShouDimensionMaterialMapper.java
  44. 15 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/mapper/KuaiShouDimensionRegionConfigMapper.java
  45. 19 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/mapper/KuaiShouDimensionRegionDetailMapper.java
  46. 15 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/mapper/KuaiShouDimensionStrategyMapper.java
  47. 27 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/mapper/KuaiShouDimensionUnitMapper.java
  48. 15 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/mapper/KuaiShouDimensionVariableMapper.java
  49. 44 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/mapper/xml/KuaiShouDimensionAccountMapper.xml
  50. 5 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/mapper/xml/KuaiShouDimensionAgeConfigMapper.xml
  51. 5 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/mapper/xml/KuaiShouDimensionCampaignMapper.xml
  52. 59 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/mapper/xml/KuaiShouDimensionCreativeMapper.xml
  53. 72 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/mapper/xml/KuaiShouDimensionMaterialMapper.xml
  54. 5 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/mapper/xml/KuaiShouDimensionRegionConfigMapper.xml
  55. 12 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/mapper/xml/KuaiShouDimensionRegionDetailMapper.xml
  56. 5 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/mapper/xml/KuaiShouDimensionStrategyMapper.xml
  57. 58 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/mapper/xml/KuaiShouDimensionUnitMapper.xml
  58. 5 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/mapper/xml/KuaiShouDimensionVariableMapper.xml
  59. 30 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/service/IKuaiShouDimensionAccountService.java
  60. 21 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/service/IKuaiShouDimensionAgeConfigService.java
  61. 15 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/service/IKuaiShouDimensionCampaignService.java
  62. 26 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/service/IKuaiShouDimensionCreativeService.java
  63. 25 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/service/IKuaiShouDimensionMaterialService.java
  64. 18 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/service/IKuaiShouDimensionRegionConfigService.java
  65. 22 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/service/IKuaiShouDimensionRegionDetailService.java
  66. 20 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/service/IKuaiShouDimensionStrategyService.java
  67. 32 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/service/IKuaiShouDimensionUnitService.java
  68. 19 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/service/IKuaiShouDimensionVariableService.java
  69. 150 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/service/impl/KuaiShouDimensionAccountServiceImpl.java
  70. 49 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/service/impl/KuaiShouDimensionAgeConfigServiceImpl.java
  71. 23 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/service/impl/KuaiShouDimensionCampaignServiceImpl.java
  72. 221 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/service/impl/KuaiShouDimensionCreativeServiceImpl.java
  73. 46 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/service/impl/KuaiShouDimensionMaterialServiceImpl.java
  74. 27 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/service/impl/KuaiShouDimensionRegionConfigServiceImpl.java
  75. 58 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/service/impl/KuaiShouDimensionRegionDetailServiceImpl.java
  76. 794 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/service/impl/KuaiShouDimensionStrategyServiceImpl.java
  77. 296 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/service/impl/KuaiShouDimensionUnitServiceImpl.java
  78. 188 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/service/impl/KuaiShouDimensionVariableServiceImpl.java
  79. 3 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/EtlKuaishouReportAccountDailyMapper.java
  80. 44 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/EtlKuaishouReportAccountDailyMapper.xml
  81. 3 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IEtlKuaishouReportAccountDailyService.java
  82. 7 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/EtlKuaishouReportAccountDailyServiceImpl.java
  83. 1 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/xml/BytedanceVideoReportMapper.xml

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

@@ -200,6 +200,7 @@ public class ShiroConfig {
         //filterChainDefinitionMap.put("/overView/*", "anon");
         filterChainDefinitionMap.put("/kuaishouCrowdPack/**", "anon");
         filterChainDefinitionMap.put("/kuaishou/batch/*", "anon");
+        filterChainDefinitionMap.put("/dimension/kuaiShouDimensionAccount/*", "anon");
         filterChainDefinitionMap.put("/ai/projectCreate/*", "anon");
 
         // 添加自己的过滤器并且取名为jwt

+ 80 - 15
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/UserAllocationController.java

@@ -15,10 +15,10 @@ import cn.com.ctop.common.module.service.IUserAllocationService;
 import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.QueryGenerator;
 import cn.com.ctop.common.module.utils.StringUtils;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouAdvertiserBaseInfo;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouAdvertiserBaseInfoService;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
 import cn.com.ctop.toutiao.modules.material.service.IByteDanceAdvertiserDataService;
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
@@ -75,6 +75,30 @@ public class UserAllocationController {
     private IKuaiShouAdvertiserBaseInfoService kuaiShouAdvertiserBaseInfoService;
     @Autowired
     private IByteDanceAdvertiserDataService advertiserDataService;
+
+
+    @PostMapping(value = "/getAccountDetailByAccountIds")
+    public Result<List<JSONObject>> getAccountDetailByAccountId(@RequestBody JSONObject requestJson) {
+        Result<List<JSONObject>> result = new Result<>();
+        try {
+            if (Check.isNull(requestJson)) {
+                throw new Exception("请选择账户id");
+            }
+            JSONArray accountIds = requestJson.getJSONArray("accountIds");
+            if (Check.isNull(accountIds)) {
+                throw new Exception("账户id列表不能为空");
+            }
+            List<JSONObject> accountDetails = userAllocationService.getByAccountIds(accountIds);
+            result.setSuccess(true);
+            result.setResult(accountDetails);
+        } catch (Exception e) {
+            result.setSuccess(false);
+            result.success(e.getMessage());
+        }
+        return result;
+    }
+
+
     @GetMapping(value = "/getUserIdListByProductId")
     public Result<List<JSONObject>> getUserIdListByProductId(Long productId) {
         Result<List<JSONObject>> result = new Result<>();
@@ -91,8 +115,48 @@ public class UserAllocationController {
         }
         return result;
     }
+
+
+    /**
+     * 根据项目id查询
+     *
+     * @param projectId
+     * @return
+     */
+    @GetMapping(value = "/getByProjectId")
+    public Result<JSONArray> getByProjectId(Long projectId) {
+        Result<JSONArray> result = new Result<>();
+        try {
+            if (Check.isNull(projectId)) {
+                throw new Exception("请选择项目id");
+            }
+            JSONArray array = new JSONArray();
+            List<Long> userIdList = userAllocationService.getKuaiShouUserIdListByProjectId(projectId);
+            if (!Check.isNull(userIdList)) {
+
+                for (int i = 0; i < userIdList.size(); i++) {
+                    Long userId = userIdList.get(i);
+                    JSONObject json = new JSONObject();
+                    json.put("userId", userId);
+                    List<JSONObject> accountList = userAllocationService.selectAccountsByKuaishouUserId(userId);
+                    if (!Check.isNull(accountList)) {
+                        json.put("accounts", accountList);
+                    }
+                    array.add(json);
+                }
+            }
+            result.setSuccess(true);
+            result.setResult(array);
+        } catch (Exception e) {
+            result.setSuccess(false);
+            result.success(e.getMessage());
+        }
+        return result;
+    }
+
+
     @GetMapping(value = "/getAccountListByUserIdAndProductId")
-    public Result<List<ProjectMember>> getAccountListByUserIdAndProductId(String userId,Long productId,Integer mediaId){
+    public Result<List<ProjectMember>> getAccountListByUserIdAndProductId(String userId, Long productId, Integer mediaId) {
         Result<List<ProjectMember>> result = new Result<>();
         String roleCode = sysRoleService.getRoleCodeByUserId(userId);
         if ("admin".equals(roleCode)) {
@@ -100,17 +164,17 @@ public class UserAllocationController {
         }
         List<Integer> mediaList = new ArrayList<>();
         mediaList.add(mediaId);
-    //    List<ProjectMember> projectList = projectMemberService.getOwnProjects(mediaList);
-        List<ProjectMember> productList = projectMemberService.getOwnProducts(mediaList,productId);
-        log.info("產品列表:{}",productList);
+        //    List<ProjectMember> projectList = projectMemberService.getOwnProjects(mediaList);
+        List<ProjectMember> productList = projectMemberService.getOwnProducts(mediaList, productId);
+        log.info("產品列表:{}", productList);
 
-      //  projectMemberService.getOwnProjects(mediaList);
+        //  projectMemberService.getOwnProjects(mediaList);
         List<ProjectMember> projectMemberList = new ArrayList<>();
-        for (ProjectMember projectMember: productList){
-            if (!projectMember.getProductId().equals(productId)){
+        for (ProjectMember projectMember : productList) {
+            if (!projectMember.getProductId().equals(productId)) {
                 continue;
             }
-            List<UserAllocation> userAllocationList = userAllocationService.getAccountListByUserIdAndProductId(userId,projectMember.getProjectId(),productId);
+            List<UserAllocation> userAllocationList = userAllocationService.getAccountListByUserIdAndProductId(userId, projectMember.getProjectId(), productId);
             projectMember.setUserAllocationList(userAllocationList);
             projectMemberList.add(projectMember);
         }
@@ -118,8 +182,9 @@ public class UserAllocationController {
         result.setSuccess(true);
         return result;
     }
+
     @GetMapping(value = "/getBytedanceAccountListByUserIdAndProductId")
-    public Result<List<ProjectMember>> getBytedanceAccountListByUserIdAndProductId(String userId,Long productId,Integer mediaId){
+    public Result<List<ProjectMember>> getBytedanceAccountListByUserIdAndProductId(String userId, Long productId, Integer mediaId) {
         Result<List<ProjectMember>> result = new Result<>();
         String roleCode = sysRoleService.getRoleCodeByUserId(userId);
         if ("admin".equals(roleCode)) {
@@ -130,11 +195,11 @@ public class UserAllocationController {
         List<ProjectMember> projectList = projectMemberService.getOwnProjects(mediaList);
         projectMemberService.getOwnProjects(mediaList);
         List<ProjectMember> projectMemberList = new ArrayList<>();
-        for (ProjectMember projectMember: projectList){
-            if (projectMember.getProductId() != productId){
+        for (ProjectMember projectMember : projectList) {
+            if (projectMember.getProductId() != productId) {
                 continue;
             }
-            List<UserAllocation> userAllocationList = userAllocationService.getAccountListByUserIdAndProductId(userId,projectMember.getProjectId(),productId);
+            List<UserAllocation> userAllocationList = userAllocationService.getAccountListByUserIdAndProductId(userId, projectMember.getProjectId(), productId);
             projectMember.setUserAllocationList(userAllocationList);
             projectMemberList.add(projectMember);
         }
@@ -365,7 +430,7 @@ public class UserAllocationController {
      */
     @GetMapping(value = "/queryAccountIdsByProjectId")
     public Result<Object> queryAccountIdsByProjectId(Long projectId) {
-        if(Check.isNull(projectId)){
+        if (Check.isNull(projectId)) {
             return Result.error("请选择项目");
         }
         try {
@@ -374,7 +439,7 @@ public class UserAllocationController {
         } catch (Exception e) {
             e.printStackTrace();
         }
-        return  Result.error("查询失败");
+        return Result.error("查询失败");
     }
 
 

+ 3 - 3
jeecg-boot-module-system/src/main/resources/application-dev.yml

@@ -135,9 +135,9 @@ spring:
         connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
       datasource:
         master:
-          url: jdbc:mysql://139.186.27.96:4000/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
-          username: data
-          password: hcst@2021
+          url: jdbc:mysql://139.186.165.84:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true
+          username: hcst
+          password: hcst@2020
           driver-class-name: com.mysql.jdbc.Driver
           # 多数据源配置
           #multi-datasource1:

+ 6 - 6
jeecg-boot-module-system/src/main/resources/jeecg/jeecg_database.properties

@@ -1,10 +1,10 @@
 #mysql
 diver_name=com.mysql.jdbc.Driver
-#url=jdbc:mysql://139.186.151.174:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
-#username=hcst
-#password=hcst@2020
-url=jdbc:mysql://139.186.27.96:4000/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
-username=data
-password=hcst@2021
+url=jdbc:mysql://139.186.165.84:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
+username=hcst
+password=hcst@2020
+#url=jdbc:mysql://139.186.27.96:4000/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
+#username=data
+#password=hcst@2021
 database_name=jeecg-boot
 

+ 20 - 171
jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java

@@ -4,12 +4,10 @@ import cn.com.ctop.common.module.entity.BindAccountLogin;
 import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.service.IBindAccountLoginService;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
-import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.CtopAdConstant;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaishouOperationRecord;
-import cn.com.ctop.kuaishou.modules.batch.mapper.KuaishouOperationRecordMapper;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
-import cn.com.ctop.kuaishou.modules.batch.service.impl.KuaishouInterfaceServiceImpl2;
+import cn.com.ctop.kuaishou.modules.dimension.service.IKuaiShouDimensionStrategyService;
+import cn.com.ctop.kuaishou.modules.dimension.service.IKuaiShouDimensionVariableService;
 import cn.com.ctop.kuaishou.modules.graphql.service.IKuaishouWebInterfaceService;
 import cn.com.ctop.kuaishou.modules.report.mapper.EtlKuaishouAccountMaterialReportDailyMapper;
 import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyImageService;
@@ -19,7 +17,6 @@ import cn.com.ctop.toutiao.modules.material.service.IByteDanceAdvertiserDataServ
 import cn.com.ctop.toutiao.modules.report.entity.BytedanceCheckReportTaskInfo;
 import cn.com.ctop.toutiao.modules.report.service.*;
 import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
 import com.xxl.job.core.context.XxlJobHelper;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.util.DateUtils;
@@ -32,8 +29,9 @@ import org.springframework.test.context.junit4.SpringRunner;
 
 import javax.annotation.Resource;
 import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.*;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
@@ -83,15 +81,25 @@ public class SampleTest {
     private IETLReportBytedanceVideoService etlReportBytedanceVideoService;
     @Autowired
     private IKuaishouInterfaceService iKuaishouInterfaceService;
+    @Autowired
+    private IKuaiShouDimensionVariableService kuaiShouDimensionVariableService;
+    @Autowired
+    private IKuaiShouDimensionStrategyService dimensionStrategyService;
+    @Autowired
+    private IKuaiShouDimensionVariableService dimensionVariableService;
 
 
     @Test
     public void loadKuaishouCookie() throws ParseException {
-        CtopOauthToken token = tokenService.getTokenByAccountId(10494982L);
-        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
-        Date parse = simpleDateFormat.parse("2021-07-27");
-        Date pars1 = simpleDateFormat.parse("2021-07-27");
-        iKuaishouInterfaceService.getAdvertiserReportHourly(token, parse, pars1);
+      //  JSONArray dimensionVariableList = kuaiShouDimensionVariableService.getDimensionVariableList(1L);
+        JSONArray array = new JSONArray();
+        array.add(1);
+        array.add(2);
+        array.add(3);
+        // dimensionStrategyService.create(1L, array);
+        JSONArray dimensionVariableList = dimensionVariableService.getDimensionVariableList(8L); // 获取变量排列组合
+
+        System.err.println(dimensionVariableList);
     }
 
 
@@ -248,163 +256,4 @@ public class SampleTest {
             bytedanceVideoEtlInfoService.etlBytedanceVideoInfo(DateUtils.parseDate(getDate, "yyyy-MM-dd"));
         }
     }
-    @Resource
-    private KuaishouOperationRecordMapper kuaishouOperationRecordMapper;
-
-
-    @Test
-    public void dealOperationRecordData() throws InterruptedException {
-        Date beginDate = DateUtils.parseDate("2021-06-01", "yyyy-MM-dd");
-        Date endDate = DateUtils.parseDate("2021-07-19", "yyyy-MM-dd");
-//        Date beginDate = DateUtils.parseDate("2020-04-21", "yyyy-MM-dd");
-//        Date endDate = DateUtils.parseDate("2021-07-17", "yyyy-MM-dd");
-
-        int recordsCount = 0;
-        int newRecordCount = 0;
-
-        while (beginDate.before(endDate)){
-            System.out.println("开始拆分数据,当前时间为:" + beginDate);
-//            List<KuaishouOperationRecord> records = kuaishouOperationRecordMapper.selectCreativeRecordByStatDate(DateUtils.formatDate(beginDate, "yyyy-MM-dd"));    //开始拆分数据,当前时间为:Tue Apr 28 00:00:00 CST 2020
-//            List<KuaishouOperationRecord> records = kuaishouOperationRecordMapper.selectAccountRecordByStatDate(DateUtils.formatDate(beginDate, "yyyy-MM-dd"));
-//            List<KuaishouOperationRecord> records = kuaishouOperationRecordMapper.selectAppRecordByStatDate(DateUtils.formatDate(beginDate, "yyyy-MM-dd"));
-//            List<KuaishouOperationRecord> records = kuaishouOperationRecordMapper.selectCampaignRecordByStatDate(DateUtils.formatDate(beginDate, "yyyy-MM-dd"));  //已执行完毕
-//            List<KuaishouOperationRecord> records = kuaishouOperationRecordMapper.selectPackageRecordByStatDate(DateUtils.formatDate(beginDate, "yyyy-MM-dd"));
-            List<KuaishouOperationRecord> records = kuaishouOperationRecordMapper.selectUnitRecordByStatDate(DateUtils.formatDate(beginDate, "yyyy-MM-dd"));    //已执行完毕
-//            List<KuaishouOperationRecord> records = kuaishouOperationRecordMapper.selectVideoRecordByStatDate(DateUtils.formatDate(beginDate, "yyyy-MM-dd"));
-            if(Check.isNull(records)){
-                System.out.print("     -> 今日的数据为空!!!");
-                beginDate = DateUtils.addDay(beginDate, 1);
-                continue;
-            }
-            recordsCount += records.size();
-            countDownLatch = new CountDownLatch(records.size());
-
-            List<KuaishouOperationRecord> newRecords = new ArrayList<>();
-
-            records.forEach(record -> executorService.submit(() -> {
-                try{
-                    String log = record.getLog();
-                    JSONArray jsonArray = JSONArray.parseArray(log);
-                    for(int i=0;i<jsonArray.size();i++){
-                        JSONObject object = jsonArray.getJSONObject(i);
-                        String originalData = object.getString("original_data");
-                        String updateData = object.getString("update_data");
-                        String fieldName = object.getString("field_name");
-                        KuaishouOperationRecord newRecord = new KuaishouOperationRecord(record);
-                        newRecord.setOriginalData(originalData);
-                        newRecord.setUpdateData(updateData);
-                        newRecord.setFieldName(fieldName);
-
-                        if("".equals(newRecord.getOriginalData()) && "".equals(newRecord.getUpdateData())){
-                            continue;
-                        }
-                        newRecords.add(newRecord);
-                    }
-                }catch (Exception e){
-                }finally {
-                    countDownLatch.countDown();
-            }}));
-            countDownLatch.await();
-            newRecordCount += newRecords.size();
-            this.saveOperationRecordListToDb(newRecords);
-            beginDate = DateUtils.addDay(beginDate, 1);
-        }
-        System.out.println("---------------------------------------------------------------");
-        System.out.println("------------获取数据结束"+recordsCount+"条原始数据变成了"+newRecordCount+"条数据------------");
-        System.out.println("---------------------------------------------------------------");
-    }
-
-    private void saveOperationRecordListToDb(List<KuaishouOperationRecord> records) {
-        if (Check.isNull(records)) {
-            return;
-        }
-
-        List<KuaishouOperationRecord> batchList = new ArrayList<>();
-        records.removeAll(Collections.singleton(null));
-        Integer operationTarget = records.get(0).getOperationTarget();
-
-
-
-        for (KuaishouOperationRecord sumPosition : records) {
-            batchList.add(sumPosition);
-
-            if (batchList.size() >= 1000) {
-                if (operationTarget == 1) {
-                    kuaishouOperationRecordMapper.insertOperationRecordInfoAccountNew(batchList);
-                } else if (operationTarget == 2) {
-                    kuaishouOperationRecordMapper.insertOperationRecordInfoCampaignNew(batchList);
-                } else if (operationTarget == 3) {
-                    kuaishouOperationRecordMapper.insertOperationRecordInfoUnitNew(batchList);
-                } else if (operationTarget == 4) {
-                    kuaishouOperationRecordMapper.insertOperationRecordInfoCreativeNew(batchList);
-                } else if (operationTarget == 5) {
-                    kuaishouOperationRecordMapper.insertOperationRecordInfoVideoNew(batchList);
-                } else if (operationTarget == 6) {
-                    kuaishouOperationRecordMapper.insertOperationRecordInfoAppNew(batchList);
-                } else if (operationTarget == 7) {
-                    kuaishouOperationRecordMapper.insertOperationRecordInfoPackageNew(batchList);
-                } else {
-                    System.out.println("未知的目标类型!");
-                }
-                batchList.clear();
-            }
-        }
-        if (!batchList.isEmpty()) {
-
-            if (operationTarget == 1) {
-                kuaishouOperationRecordMapper.insertOperationRecordInfoAccountNew(batchList);
-            } else if (operationTarget == 2) {
-                kuaishouOperationRecordMapper.insertOperationRecordInfoCampaignNew(batchList);
-            } else if (operationTarget == 3) {
-                kuaishouOperationRecordMapper.insertOperationRecordInfoUnitNew(batchList);
-            } else if (operationTarget == 4) {
-                kuaishouOperationRecordMapper.insertOperationRecordInfoCreativeNew(batchList);
-            } else if (operationTarget == 5) {
-                kuaishouOperationRecordMapper.insertOperationRecordInfoVideoNew(batchList);
-            } else if (operationTarget == 6) {
-                kuaishouOperationRecordMapper.insertOperationRecordInfoAppNew(batchList);
-            } else if (operationTarget == 7) {
-                kuaishouOperationRecordMapper.insertOperationRecordInfoPackageNew(batchList);
-            } else {
-                System.out.println("未知的目标类型!");
-            }
-            batchList.clear();
-        }
-
-    }
-    @Autowired
-    KuaishouInterfaceServiceImpl2 kuaishouInterfaceServiceImpl2;
-
-    @Test
-    public void getUnitData(){
-        List<Long> accountIdList = new ArrayList<>();
-        accountIdList.add(9556188l);
-        accountIdList.add(9677284l);
-        accountIdList.add(9677304l);
-        accountIdList.add(10072135l);
-        accountIdList.add(9901975l);
-        accountIdList.add(9677344l);
-        accountIdList.add(9901956l);
-        accountIdList.add(9556431l);
-        accountIdList.add(9767055l);
-        accountIdList.add(10248827l);
-
-        Date beginDate = DateUtils.parseDate("2021-06-01", "yyyy-MM-dd");
-        Date endDate = DateUtils.parseDate("2021-07-19", "yyyy-MM-dd");
-
-        while (beginDate.before(endDate)){
-            for(Long accountId : accountIdList){
-                kuaishouInterfaceServiceImpl2.getOperationRecord( accountId,
-                        tokenService.getOauthTokenByAccountId(String.valueOf(accountId)).getAccessToken(),
-                        3,
-                        DateUtils.formatDate(beginDate,"yyyy-MM-dd"),
-                        DateUtils.formatDate(beginDate,"yyyy-MM-dd"));
-                System.out.println("获取完毕 -> accountId:" + accountId +",日期:" + DateUtils.formatDate(beginDate,"yyyy-MM-dd"));
-
-            }
-            beginDate = DateUtils.addDay(beginDate, 1);
-        }
-        System.out.println("走完了~");
-    }
-
 }

+ 10 - 4
module-common/src/main/java/cn/com/ctop/common/module/mapper/UserAllocationMapper.java

@@ -37,20 +37,26 @@ public interface UserAllocationMapper extends BaseMapper<UserAllocation> {
 
     JSONObject getSwitchStatusByAccount(@Param("accountId") Long accountId);
 
-    List<Long>  queryAccountsByDeleteComment();
+    List<Long> queryAccountsByDeleteComment();
 
     String getCompanyNameByUserId(@Param("planId") String planId);
 
-    List<UserAllocation> listByMediaId(@Param("mediaId")String mediaId, @Param("accountStatus")Integer accountStatus);
+    List<UserAllocation> listByMediaId(@Param("mediaId") String mediaId, @Param("accountStatus") Integer accountStatus);
 
     List<JSONObject> getAccountListByProjectList(@Param("list") List list);
 
-    List<Long> getValidProjectIds(@Param("mediaId")  Integer mediaId);
+    List<Long> getValidProjectIds(@Param("mediaId") Integer mediaId);
 
-    List<UserAllocation> getAccountListByUserIdAndProductId(@Param("userId")String userId,@Param("projectId")Long projectId,@Param("productId")Long productId);
+    List<UserAllocation> getAccountListByUserIdAndProductId(@Param("userId") String userId, @Param("projectId") Long projectId, @Param("productId") Long productId);
 
     List<JSONObject> getUserIdListByProductId(@Param("productId") Long productId);
 
+    List<JSONObject> getByAccountIds(@Param("accountIds") JSONArray accountIds);
+
+    List<Long> getKuaiShouUserIdListByProjectId(@Param("projectId") Long projectId);
+
+    List<JSONObject> selectAccountsByKuaishouUserId(@Param("userId") Long userId);
+
     int updateProjectStrategyStatus(@Param("accountId") Long accountId,@Param("projectStrategy") Integer projectStrategy);
 
     List<Long> queryAutomaticAccounts(@Param("projectId") Long projectId);

+ 42 - 8
module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/UserAllocationMapper.xml

@@ -17,14 +17,14 @@
     <select id="getAccountListByUserIdAndProductId" resultType="cn.com.ctop.common.module.entity.UserAllocation">
         select cua.account_id, cua.auth_name, cua.user_name
         from ctop_user_allocation cua
-                 left join ctop_project cp on cua.project_id = cp.id
+        left join ctop_project cp on cua.project_id = cp.id
         where
-              cua.project_id = #{projectId}
-          and
-              cp.product_id=#{productId}
-          <if test="userId != null and userId != ''">
-              and cua.user_id = #{userId}
-          </if>
+        cua.project_id = #{projectId}
+        and
+        cp.product_id=#{productId}
+        <if test="userId != null and userId != ''">
+            and cua.user_id = #{userId}
+        </if>
 
     </select>
 
@@ -102,7 +102,7 @@
         SELECT project_id FROM ctop_user_allocation t1
         where account_status = 0
         <if test="mediaId != null">
-              AND media_id = #{mediaId}
+            AND media_id = #{mediaId}
         </if>
         GROUP BY project_id
     </select>
@@ -193,6 +193,40 @@
             and p.media_id = #{mediaId}
         </if>
     </select>
+    <select id="getByAccountIds" resultType="com.alibaba.fastjson.JSONObject">
+        select
+        account_id as 'accountId',
+        auth_name as 'authName'
+        from ctop_user_allocation where
+        account_id in
+        <foreach collection="accountIds" item="item" separator=","
+                 open="(" close=")">
+            #{item}
+        </foreach>
+
+
+    </select>
+    <select id="getKuaiShouUserIdListByProjectId" resultType="java.lang.Long">
+        select t2.user_id from ctop_user_allocation t1
+        left join  ctop_kuaishou_advertiser_base_info t2
+        on t1.account_id = t2.account_id
+        where t1.project_id = #{projectId}
+        group by t2.user_id
+    </select>
+    <select id="selectAccountsByKuaishouUserId" resultType="com.alibaba.fastjson.JSONObject">
+    SELECT
+	t2.account_id AS 'accountId',
+	t2.user_name AS 'userName',
+	t2.auth_name AS 'authName',
+	t2.account_status AS 'accountStatus'
+    FROM
+	ctop_kuaishou_advertiser_base_info t1
+    LEFT JOIN ctop_user_allocation t2 ON t1.account_id = t2.account_id
+    WHERE
+	t1.user_id = #{userId}
+    AND t2.id IS NOT NULL;
+
+    </select>
 
     <update id="updateProjectStrategyStatus">
         update ctop_user_allocation set auto_delivery = #{projectStrategy}

+ 7 - 1
module-common/src/main/java/cn/com/ctop/common/module/service/IUserAllocationService.java

@@ -1,6 +1,7 @@
 package cn.com.ctop.common.module.service;
 
 import cn.com.ctop.common.module.entity.UserAllocation;
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.service.IService;
 import org.apache.ibatis.annotations.Param;
@@ -44,7 +45,7 @@ public interface IUserAllocationService extends IService<UserAllocation> {
 
     List<Long> getAccountsByDeleteComment();
 
-    List<UserAllocation> getAccountListByUserIdAndProductId(String userId,Long projectId,Long productId);
+    List<UserAllocation> getAccountListByUserIdAndProductId(String userId, Long projectId, Long productId);
 
     Map<Long, List<JSONObject>> getAccountListByProjectList(List<JSONObject> projectList);
 
@@ -58,6 +59,11 @@ public interface IUserAllocationService extends IService<UserAllocation> {
      */
     List<Long> getValidProjectIds(Integer mediaId);
 
+    List<JSONObject> getByAccountIds(JSONArray accountIds);
+
+    List<Long> getKuaiShouUserIdListByProjectId(Long projectId);
+
+    List<JSONObject> selectAccountsByKuaishouUserId(Long userId);
     boolean updateProjectStrategyStatus(Long accountId, Integer projectStrategy);
 
     List<Long> queryAutomaticAccounts(Long projectId);

+ 16 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/impl/UserAllocationServiceImpl.java

@@ -7,6 +7,7 @@ import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.CtopAdConstant;
 import cn.com.ctop.common.module.utils.ResultMapUtils;
 import cn.com.ctop.common.module.utils.StatusCode;
+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;
@@ -195,6 +196,21 @@ public class UserAllocationServiceImpl extends ServiceImpl<UserAllocationMapper,
     }
 
     @Override
+    public List<JSONObject> getByAccountIds(JSONArray accountIds) {
+        return userAllocationMapper.getByAccountIds(accountIds);
+    }
+
+    @Override
+    public List<Long> getKuaiShouUserIdListByProjectId(Long projectId) {
+        return userAllocationMapper.getKuaiShouUserIdListByProjectId(projectId);
+    }
+
+    @Override
+    public List<JSONObject> selectAccountsByKuaishouUserId(Long userId) {
+        return userAllocationMapper.selectAccountsByKuaishouUserId(userId);
+    }
+
+    @Override
     public boolean updateProjectStrategyStatus(Long accountId, Integer projectStrategy) {
         int num = userAllocationMapper.updateProjectStrategyStatus(accountId, projectStrategy);
         return num > 0;

+ 76 - 0
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouDimensionCreateJob.java

@@ -0,0 +1,76 @@
+package cn.com.ctop.job.kuaishou.handler;
+
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.common.module.utils.HttpUtils2;
+import cn.com.ctop.kuaishou.modules.dimension.entity.KuaiShouDimensionStrategy;
+import cn.com.ctop.kuaishou.modules.dimension.service.IKuaiShouDimensionCreativeService;
+import cn.com.ctop.kuaishou.modules.dimension.service.IKuaiShouDimensionStrategyService;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.xxl.job.core.handler.annotation.XxlJob;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 账户维度-盯盘每小时数据
+ *
+ * @author syh
+ */
+@Slf4j
+@Component
+public class KuaishouDimensionCreateJob {
+    @Autowired
+    private IKuaiShouDimensionStrategyService strategyService;
+    @Autowired
+    private IKuaiShouDimensionCreativeService dimensionCreativeService;
+
+    @Value("${xxl-job.requestUrl}")
+    private String jobUrl;
+
+    @XxlJob("createUnit")
+    public void createUnit() throws Exception {
+        QueryWrapper<KuaiShouDimensionStrategy> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("strategy_status", 0);
+        List<KuaiShouDimensionStrategy> list = strategyService.list(queryWrapper);
+        if (Check.isNull(list)) {
+            return;
+        }
+        String url = jobUrl + "/dimension/kuaiShouDimensionAccount/createUnit";
+        for (KuaiShouDimensionStrategy strategy : list) {
+            try {
+                Map<String, Object> requestMap = new HashMap<>();
+                requestMap.put("strategyId", strategy.getId());
+                HttpUtils2.httpGet(url, requestMap, null);
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+    }
+
+    @XxlJob("againCreateCreative")
+    public void againCreateCreative() throws Exception {
+        List<Long> accountIds = dimensionCreativeService.getAccountList();
+        if (Check.isNull(accountIds)) {
+            log.info("暂无待提交创意账户");
+            return;
+        }
+        String url = jobUrl + "/dimension/kuaiShouDimensionCreative/againCreateCreative";
+        for (int i = 0; i < accountIds.size(); i++) {
+            Long accountId = accountIds.get(i);
+            try {
+                Map<String, Object> requestMap = new HashMap<>();
+                requestMap.put("accountId", accountId);
+                HttpUtils2.httpGet(url, requestMap, null);
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+
+        }
+    }
+
+}

+ 5 - 42
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/BatchController.java

@@ -10,42 +10,13 @@ import cn.com.ctop.common.module.utils.BigDecimalUtil;
 import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.QueryGenerator;
 import cn.com.ctop.common.module.utils.RandomUtil;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouActionBarText;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouAdvertiserBaseInfo;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouAppInfo;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouAppList;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouCampaign;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouCreative;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouDirectionalTemplate;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouGroup;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouGroupTarget;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouImageGet;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouRegionListParent;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouTargetingTags;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouVideoGet;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaishouPopulation;
+import cn.com.ctop.kuaishou.modules.batch.entity.*;
 import cn.com.ctop.kuaishou.modules.batch.entity.vo.ConvertVo;
 import cn.com.ctop.kuaishou.modules.batch.entity.vo.SpendVo;
 import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouCampaignMapper;
 import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouGroupMapper;
 import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouTargetingTagsMapper;
-import cn.com.ctop.kuaishou.modules.batch.service.IBatchService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouActionBarTextService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouAdvertiserBaseInfoService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouAppInfoService;
-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.IKuaiShouCreativeService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouDirectionalTemplateService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouGroupService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouGroupTargetService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouImageGetService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouRegionListParentService;
-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.batch.service.IKuaishouPopulationService;
-import cn.com.ctop.kuaishou.modules.batch.service.ISyncPullMaterialService;
+import cn.com.ctop.kuaishou.modules.batch.service.*;
 import cn.com.ctop.kuaishou.modules.report.service.IEtlKuaiShouGroupDailyReportService;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
@@ -57,14 +28,7 @@ import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.util.DateUtils;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
 import java.math.BigDecimal;
@@ -2285,9 +2249,8 @@ public class BatchController {
     public Result<Boolean> syncVideo(Long accountId) {
         Result<Boolean> result = new Result<>();
         try {
-            String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
-            String startDate = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -7);
-            syncPullMaterialService.getSyncVideoList(accountId, startDate, nowDate);
+
+            syncPullMaterialService.getSyncVideoList(accountId, null, null);
             result.setSuccess(true);
             result.setResult(true);
         } catch (Exception e) {

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

@@ -1,10 +1,16 @@
 package cn.com.ctop.kuaishou.modules.batch.controller;
 
 import cn.com.ctop.common.module.annotation.AutoLog;
+import cn.com.ctop.common.module.entity.CtopOauthToken;
+import cn.com.ctop.common.module.service.ICtopOauthTokenService;
+import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.QueryGenerator;
 import cn.com.ctop.common.module.utils.StringUtils;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouAppList;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouAppListService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
+import com.alibaba.fastjson.JSONArray;
+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;
@@ -17,6 +23,7 @@ import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
 import java.util.Arrays;
+import java.util.List;
 
 /**
  * @Description: 快手-应用列表
@@ -32,6 +39,38 @@ public class KuaiShouAppListController {
     @Autowired
     private IKuaiShouAppListService kuaiShouAppListService;
 
+    @Autowired
+    private IKuaishouInterfaceService iKuaishouInterfaceService;
+    @Autowired
+    private ICtopOauthTokenService oauthTokenService;
+
+
+    @PostMapping(value = "/refreshAppByAccountIds")
+    public Result<List<JSONObject>> getAccountDetailByAccountId(@RequestBody JSONObject requestJson) {
+        Result<List<JSONObject>> result = new Result<>();
+        try {
+            if (Check.isNull(requestJson)) {
+                throw new Exception("请选择账户id");
+            }
+            JSONArray accountIds = requestJson.getJSONArray("accountIds");
+            if (Check.isNull(accountIds)) {
+                throw new Exception("账户id列表不能为空");
+            }
+            for (int i = 0; i < accountIds.size(); i++) {
+                Long accountId = accountIds.getLong(i);
+                CtopOauthToken oauthToken = oauthTokenService.getTokenByAccountId(accountId);
+                iKuaishouInterfaceService.getAppList(oauthToken.getAccountId(), oauthToken.getAccessToken());
+            }
+            result.setSuccess(true);
+            result.setMessage("刷新成功");
+        } catch (Exception e) {
+            result.setSuccess(false);
+            result.success(e.getMessage());
+        }
+        return result;
+    }
+
+
     /**
      * 分页列表查询
      *

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

@@ -54,4 +54,6 @@ public interface KuaiShouVideoGetMapper extends BaseMapper<KuaiShouVideoGet> {
     List<JSONObject> getAccountIds();
 
     List<String> queryPhotoIdsByProjectAndMd5(@Param("projectId") Long projectId, @Param("signature") String signature, @Param("accountId") JSONArray accountId);
+
+    JSONObject getVideoByPhotoIdAndAccountId(@Param("accountId") Long accountId,@Param("photoId") Long photoId);
 }

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

@@ -45,6 +45,7 @@
      from
      ctop_kuaishou_video_get
      where  photo_id = #{photoId}
+     and status = 0
      limit 1
     </select>
 

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

@@ -342,6 +342,15 @@
         </if>
         GROUP BY photo_id
     </select>
+    <select id="getVideoByPhotoIdAndAccountId" resultType="com.alibaba.fastjson.JSONObject">
+        select  cover_url as 'coverUrl',
+                url as 'photoUrl'
+          from ctop_kuaishou_video_get
+        where  account_id = #{accountId}
+        and photo_id = #{photoId}
+        limit 1
+
+    </select>
 
     <update id="updateBatch">
         UPDATE ctop_kuaishou_video_get SET

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

@@ -59,4 +59,6 @@ public interface IKuaiShouVideoGetService extends IService<KuaiShouVideoGet> {
     List<JSONObject> getAccountIds();
 
     List<String> queryPhotoIdsByProjectAndMd5(Long projectId, String signature, JSONArray accountId);
+
+    JSONObject getVideoByPhotoIdAndAccountId(Long accountId, Long photoId);
 }

+ 11 - 12
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouVideoGetServiceImpl.java

@@ -22,13 +22,7 @@ import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
 import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
+import java.util.*;
 
 /**
  * @Description: 快手-获取视频接口
@@ -294,7 +288,7 @@ public class KuaiShouVideoGetServiceImpl extends ServiceImpl<KuaiShouVideoGetMap
      * 素造接口,获取同步供应商素材标签数据
      */
     @Override
-    public void getSuZaoList(String token, Long accountId, int page,String startDate) {
+    public void getSuZaoList(String token, Long accountId, int page, String startDate) {
         String url = "https://ad.e.kuaishou.com/rest/openapi/v1/ad_creator/video/list";
         Map<String, String> headers = new HashMap<String, String>();
         headers.put("Content-Type", "application/json");
@@ -304,7 +298,7 @@ public class KuaiShouVideoGetServiceImpl extends ServiceImpl<KuaiShouVideoGetMap
         param.put("page", page);
         param.put("page_size", 200);
         param.put("start_date", startDate);
-        param.put("end_date", DateUtils.formatDate(new Date(),DateUtils.NEW_FORMAT));
+        param.put("end_date", DateUtils.formatDate(new Date(), DateUtils.NEW_FORMAT));
         String result = HttpUtils.httpPostRequest(url, param, headers);
         JSONObject resultJson = JSONObject.parseObject(result);
         if (Check.isNull(resultJson)) {
@@ -340,7 +334,7 @@ public class KuaiShouVideoGetServiceImpl extends ServiceImpl<KuaiShouVideoGetMap
         if (!Check.isNull(videoGetList)) {
             videoGetMapper.updateBatch(videoGetList);
         }
-        getSuZaoList(token, accountId, page + 1,startDate);
+        getSuZaoList(token, accountId, page + 1, startDate);
     }
 
     @Override
@@ -349,7 +343,12 @@ public class KuaiShouVideoGetServiceImpl extends ServiceImpl<KuaiShouVideoGetMap
     }
 
     @Override
-    public List<String> queryPhotoIdsByProjectAndMd5(Long projectId, String signature,JSONArray accountId) {
-        return videoGetMapper.queryPhotoIdsByProjectAndMd5(projectId, signature,accountId);
+    public List<String> queryPhotoIdsByProjectAndMd5(Long projectId, String signature, JSONArray accountId) {
+        return videoGetMapper.queryPhotoIdsByProjectAndMd5(projectId, signature, accountId);
+    }
+
+    @Override
+    public JSONObject getVideoByPhotoIdAndAccountId(Long accountId, Long photoId) {
+        return videoGetMapper.getVideoByPhotoIdAndAccountId(accountId, photoId);
     }
 }

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

@@ -2055,6 +2055,11 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
                     if (code == 400001 && "/rest/openapi/v2/creative/create调用已超日限,次日可恢复调用".equals(resultJson.getString("message"))) {
                         creativeOverrunInfoService.updateOverrunInfo(advertiserId);
                         overRunSendMessageService.creativeOverRunSendMessage(advertiserId, null);
+                        String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
+                        String key = advertiserId + "_" + nowDate + "creative_create_overrun";
+                        redisUtil.set(key, 1, 60 * 60 * 24);
+
+
                     }
 
                     if (code == 401000 && resultJson.getString("message").contains("超过可关联的有效创意的上限")) {

+ 310 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/controller/KuaiShouDimensionAccountController.java

@@ -0,0 +1,310 @@
+package cn.com.ctop.kuaishou.modules.dimension.controller;
+
+import cn.com.ctop.common.module.entity.CtopOauthToken;
+import cn.com.ctop.common.module.service.ICtopOauthTokenService;
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.common.module.utils.QueryGenerator;
+import cn.com.ctop.kuaishou.modules.dimension.entity.KuaiShouDimensionAccount;
+import cn.com.ctop.kuaishou.modules.dimension.service.IKuaiShouDimensionAccountService;
+import cn.com.ctop.kuaishou.modules.dimension.service.IKuaiShouDimensionUnitService;
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.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.*;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+import org.springframework.web.servlet.ModelAndView;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+/**
+ * 多维度测试关联账户表
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2021-07-19
+ */
+@Slf4j
+@Api(tags = "多维度测试关联账户表")
+@RestController
+@RequestMapping("/dimension/kuaiShouDimensionAccount")
+public class KuaiShouDimensionAccountController {
+    @Autowired
+    private IKuaiShouDimensionAccountService kuaiShouDimensionAccountService;
+    @Autowired
+    private IKuaiShouDimensionUnitService dimensionUnitService;
+
+    @Autowired
+    private ICtopOauthTokenService oauthTokenService;
+    static ExecutorService accountService = Executors.newFixedThreadPool(5);
+
+
+    /**
+     * 创建组
+     *
+     * @param strategyId
+     * @return
+     */
+    @GetMapping(value = "/createUnit")
+    public void createUnit(Long strategyId) {
+        List<KuaiShouDimensionAccount> accountIds = kuaiShouDimensionAccountService.getListByStrategyId(strategyId, 0);
+        if (Check.isNull(accountIds)) {
+            log.error("策略id下没有开启账户");
+        }
+        for (KuaiShouDimensionAccount account : accountIds) {
+            Boolean trueOrFalse = dimensionUnitService.getCreateOverrun(account.getAccountId());
+            if (trueOrFalse) {
+                log.error("该账户今日创建已超限,策略id:{},账户id:{}", strategyId, account);
+                continue;
+            }
+            CtopOauthToken token = oauthTokenService.getTokenByAccountId(account.getAccountId());
+            if (Check.isNull(token)) {
+                log.error("未获取到授权信息,策略id:{},账户id”{}", strategyId, account.getAccountId());
+                continue;
+            }
+            accountService.submit(new Runnable() {
+                @Override
+                public void run() {
+                    log.info("开始策略id为:{},组搭建", strategyId);
+                    dimensionUnitService.createUnit(strategyId, account.getAccountId(), token.getAccessToken());
+                }
+            });
+        }
+    }
+
+
+    @ApiOperation(value = "多维度测试关联账户表-分页列表查询", notes = "多维度测试关联账户表-分页列表查询")
+    @GetMapping(value = "/getStrategyBindAccount")
+    public Result<Long> getStrategyBindAccount(Long strategyId) {
+        Result<Long> result = new Result<>();
+        QueryWrapper<KuaiShouDimensionAccount> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("strategy_id", strategyId);
+        queryWrapper.eq("account_status", 0);
+        queryWrapper.orderByDesc("account_id");
+        queryWrapper.last("limit 1");
+        KuaiShouDimensionAccount one = kuaiShouDimensionAccountService.getOne(queryWrapper);
+        if (Check.isNull(one)) {
+            result.setSuccess(false);
+            result.setMessage("该策略暂未绑定账户id");
+
+        } else {
+            result.setSuccess(true);
+            result.setResult(one.getAccountId());
+        }
+        return result;
+    }
+
+
+    /**
+     * 分页列表查询
+     *
+     * @param kuaiShouDimensionAccount
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @ApiOperation(value = "多维度测试关联账户表-分页列表查询", notes = "多维度测试关联账户表-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<IPage<KuaiShouDimensionAccount>> queryPageList(KuaiShouDimensionAccount kuaiShouDimensionAccount,
+                                                                 @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                                 @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                                 HttpServletRequest req) {
+        Result<IPage<KuaiShouDimensionAccount>> result = new Result<>();
+        QueryWrapper<KuaiShouDimensionAccount> queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouDimensionAccount, req.getParameterMap());
+        Page<KuaiShouDimensionAccount> page = new Page<KuaiShouDimensionAccount>(pageNo, pageSize);
+        IPage<KuaiShouDimensionAccount> pageList = kuaiShouDimensionAccountService.page(page, queryWrapper);
+        result.setSuccess(true);
+        result.setResult(pageList);
+        return result;
+    }
+
+    /**
+     * 添加
+     *
+     * @param kuaiShouDimensionAccount
+     * @return
+     */
+    @ApiOperation(value = "多维度测试关联账户表-添加", notes = "多维度测试关联账户表-添加")
+    @PostMapping(value = "/add")
+    public Result<KuaiShouDimensionAccount> add(@RequestBody KuaiShouDimensionAccount kuaiShouDimensionAccount) {
+        Result<KuaiShouDimensionAccount> result = new Result<>();
+        try {
+            kuaiShouDimensionAccountService.save(kuaiShouDimensionAccount);
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+
+    /**
+     * 编辑
+     *
+     * @param kuaiShouDimensionAccount
+     * @return
+     */
+    @ApiOperation(value = "多维度测试关联账户表-编辑", notes = "多维度测试关联账户表-编辑")
+    @PutMapping(value = "/edit")
+    public Result<KuaiShouDimensionAccount> edit(@RequestBody KuaiShouDimensionAccount kuaiShouDimensionAccount) {
+        Result<KuaiShouDimensionAccount> result = new Result<KuaiShouDimensionAccount>();
+        KuaiShouDimensionAccount kuaiShouDimensionAccountEntity = kuaiShouDimensionAccountService.getById(kuaiShouDimensionAccount.getId());
+        if (kuaiShouDimensionAccountEntity == null) {
+            result.error500("未找到对应实体");
+        } else {
+            boolean ok = kuaiShouDimensionAccountService.updateById(kuaiShouDimensionAccount);
+            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 {
+            kuaiShouDimensionAccountService.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<KuaiShouDimensionAccount> deleteBatch(@RequestParam(name = "ids") String ids) {
+        Result<KuaiShouDimensionAccount> result = new Result<>();
+        if (ids == null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        } else {
+            this.kuaiShouDimensionAccountService.removeByIds(Arrays.asList(ids.split(",")));
+            result.success("删除成功!");
+        }
+        return result;
+    }
+
+    /**
+     * 通过id查询
+     *
+     * @param id
+     * @return
+     */
+    @ApiOperation(value = "多维度测试关联账户表-通过id查询", notes = "多维度测试关联账户表-通过id查询")
+    @GetMapping(value = "/queryById")
+    public Result<KuaiShouDimensionAccount> queryById(@RequestParam(name = "id", required = true) String id) {
+        Result<KuaiShouDimensionAccount> result = new Result<>();
+        KuaiShouDimensionAccount kuaiShouDimensionAccount = kuaiShouDimensionAccountService.getById(id);
+        if (kuaiShouDimensionAccount == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(kuaiShouDimensionAccount);
+            result.setSuccess(true);
+        }
+        return result;
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param response
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+        // Step.1 组装查询条件
+        QueryWrapper<KuaiShouDimensionAccount> queryWrapper = null;
+        try {
+            String paramsStr = request.getParameter("paramsStr");
+            if (oConvertUtils.isNotEmpty(paramsStr)) {
+                String deString = URLDecoder.decode(paramsStr, "UTF-8");
+                KuaiShouDimensionAccount kuaiShouDimensionAccount = JSON.parseObject(deString, KuaiShouDimensionAccount.class);
+                queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouDimensionAccount, request.getParameterMap());
+            }
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+
+        //Step.2 AutoPoi 导出Excel
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        List<KuaiShouDimensionAccount> pageList = kuaiShouDimensionAccountService.list(queryWrapper);
+        //导出文件名称
+        mv.addObject(NormalExcelConstants.FILE_NAME, "多维度测试关联账户表列表");
+        mv.addObject(NormalExcelConstants.CLASS, KuaiShouDimensionAccount.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<KuaiShouDimensionAccount> listKuaiShouDimensionAccounts = ExcelImportUtil.importExcel(file.getInputStream(), KuaiShouDimensionAccount.class, params);
+                kuaiShouDimensionAccountService.saveBatch(listKuaiShouDimensionAccounts);
+                return Result.ok("文件导入成功!数据行数:" + listKuaiShouDimensionAccounts.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("文件导入失败!");
+    }
+
+}

+ 231 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/controller/KuaiShouDimensionAgeConfigController.java

@@ -0,0 +1,231 @@
+package cn.com.ctop.kuaishou.modules.dimension.controller;
+
+import cn.com.ctop.common.module.utils.QueryGenerator;
+import cn.com.ctop.kuaishou.modules.dimension.entity.KuaiShouDimensionAgeConfig;
+import cn.com.ctop.kuaishou.modules.dimension.service.IKuaiShouDimensionAgeConfigService;
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.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.*;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+import org.springframework.web.servlet.ModelAndView;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 素材多维度年龄配置
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2021-07-29
+ */
+@Slf4j
+@Api(tags = "素材多维度年龄配置")
+@RestController
+@RequestMapping("/dimension/kuaiShouDimensionAgeConfig")
+public class KuaiShouDimensionAgeConfigController {
+    @Autowired
+    private IKuaiShouDimensionAgeConfigService kuaiShouDimensionAgeConfigService;
+
+    /**
+     * 分页列表查询
+     *
+     * @return
+     */
+    @ApiOperation(value = "素材多维度年龄配置-分页列表查询", notes = "素材多维度年龄配置-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<List<KuaiShouDimensionAgeConfig>> queryPageList() {
+        Result<List<KuaiShouDimensionAgeConfig>> result = new Result<>();
+        QueryWrapper<KuaiShouDimensionAgeConfig> queryWrapper = new QueryWrapper<>();
+        List<KuaiShouDimensionAgeConfig> list = kuaiShouDimensionAgeConfigService.list(queryWrapper);
+        result.setSuccess(true);
+        result.setResult(list);
+        return result;
+    }
+
+    /**
+     * 添加
+     *
+     * @param kuaiShouDimensionAgeConfig
+     * @return
+     */
+    @ApiOperation(value = "素材多维度年龄配置-添加", notes = "素材多维度年龄配置-添加")
+    @PostMapping(value = "/add")
+    public Result<KuaiShouDimensionAgeConfig> add(@RequestBody KuaiShouDimensionAgeConfig kuaiShouDimensionAgeConfig) {
+        Result<KuaiShouDimensionAgeConfig> result = new Result<>();
+        try {
+            kuaiShouDimensionAgeConfigService.save(kuaiShouDimensionAgeConfig);
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+
+    /**
+     * 编辑
+     *
+     * @param kuaiShouDimensionAgeConfig
+     * @return
+     */
+    @ApiOperation(value = "素材多维度年龄配置-编辑", notes = "素材多维度年龄配置-编辑")
+    @PutMapping(value = "/edit")
+    public Result<KuaiShouDimensionAgeConfig> edit(@RequestBody KuaiShouDimensionAgeConfig kuaiShouDimensionAgeConfig) {
+        Result<KuaiShouDimensionAgeConfig> result = new Result<KuaiShouDimensionAgeConfig>();
+        KuaiShouDimensionAgeConfig kuaiShouDimensionAgeConfigEntity = kuaiShouDimensionAgeConfigService.getById(kuaiShouDimensionAgeConfig.getId());
+        if (kuaiShouDimensionAgeConfigEntity == null) {
+            result.error500("未找到对应实体");
+        } else {
+            boolean ok = kuaiShouDimensionAgeConfigService.updateById(kuaiShouDimensionAgeConfig);
+            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 {
+            kuaiShouDimensionAgeConfigService.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<KuaiShouDimensionAgeConfig> deleteBatch(@RequestParam(name = "ids") String ids) {
+        Result<KuaiShouDimensionAgeConfig> result = new Result<>();
+        if (ids == null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        } else {
+            this.kuaiShouDimensionAgeConfigService.removeByIds(Arrays.asList(ids.split(",")));
+            result.success("删除成功!");
+        }
+        return result;
+    }
+
+    /**
+     * 通过id查询
+     *
+     * @param id
+     * @return
+     */
+    @ApiOperation(value = "素材多维度年龄配置-通过id查询", notes = "素材多维度年龄配置-通过id查询")
+    @GetMapping(value = "/queryById")
+    public Result<KuaiShouDimensionAgeConfig> queryById(@RequestParam(name = "id", required = true) String id) {
+        Result<KuaiShouDimensionAgeConfig> result = new Result<>();
+        KuaiShouDimensionAgeConfig kuaiShouDimensionAgeConfig = kuaiShouDimensionAgeConfigService.getById(id);
+        if (kuaiShouDimensionAgeConfig == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(kuaiShouDimensionAgeConfig);
+            result.setSuccess(true);
+        }
+        return result;
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param response
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+        // Step.1 组装查询条件
+        QueryWrapper<KuaiShouDimensionAgeConfig> queryWrapper = null;
+        try {
+            String paramsStr = request.getParameter("paramsStr");
+            if (oConvertUtils.isNotEmpty(paramsStr)) {
+                String deString = URLDecoder.decode(paramsStr, "UTF-8");
+                KuaiShouDimensionAgeConfig kuaiShouDimensionAgeConfig = JSON.parseObject(deString, KuaiShouDimensionAgeConfig.class);
+                queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouDimensionAgeConfig, request.getParameterMap());
+            }
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+
+        //Step.2 AutoPoi 导出Excel
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        List<KuaiShouDimensionAgeConfig> pageList = kuaiShouDimensionAgeConfigService.list(queryWrapper);
+        //导出文件名称
+        mv.addObject(NormalExcelConstants.FILE_NAME, "素材多维度年龄配置列表");
+        mv.addObject(NormalExcelConstants.CLASS, KuaiShouDimensionAgeConfig.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<KuaiShouDimensionAgeConfig> listKuaiShouDimensionAgeConfigs = ExcelImportUtil.importExcel(file.getInputStream(), KuaiShouDimensionAgeConfig.class, params);
+                kuaiShouDimensionAgeConfigService.saveBatch(listKuaiShouDimensionAgeConfigs);
+                return Result.ok("文件导入成功!数据行数:" + listKuaiShouDimensionAgeConfigs.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("文件导入失败!");
+    }
+
+}

+ 241 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/controller/KuaiShouDimensionCampaignController.java

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

+ 270 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/controller/KuaiShouDimensionCreativeController.java

@@ -0,0 +1,270 @@
+package cn.com.ctop.kuaishou.modules.dimension.controller;
+
+import cn.com.ctop.common.module.entity.CtopOauthToken;
+import cn.com.ctop.common.module.service.ICtopOauthTokenService;
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.common.module.utils.QueryGenerator;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouVideoGetService;
+import cn.com.ctop.kuaishou.modules.dimension.entity.KuaiShouDimensionCreative;
+import cn.com.ctop.kuaishou.modules.dimension.service.IKuaiShouDimensionCreativeService;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.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.*;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+import org.springframework.web.servlet.ModelAndView;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+/**
+ * 多维度测试关联创意
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2021-07-22
+ */
+@Slf4j
+@Api(tags = "多维度测试关联创意")
+@RestController
+@RequestMapping("/dimension/kuaiShouDimensionCreative")
+public class KuaiShouDimensionCreativeController {
+    @Autowired
+    private IKuaiShouDimensionCreativeService kuaiShouDimensionCreativeService;
+    @Autowired
+    private ICtopOauthTokenService oauthTokenService;
+    static ExecutorService accountCreativeService = Executors.newFixedThreadPool(10);
+    @Autowired
+    private IKuaiShouVideoGetService videoGetService;
+
+
+    @ApiOperation(value = "多维度测试关联创意-分页列表查询", notes = "多维度测试关联创意-分页列表查询")
+    @GetMapping(value = "/againCreateCreative")
+    public void againCreateCreative(Long accountId) {
+        if (Check.isNull(accountId)) {
+            log.error("账户id不能为空");
+            return;
+        }
+        CtopOauthToken token = oauthTokenService.getTokenByAccountId(accountId);
+        if (Check.isNull(token)) {
+            log.error("未获取到授权信息,账户id”{}", accountId);
+            return;
+        }
+        accountCreativeService.submit(new Runnable() {
+            @Override
+            public void run() {
+                log.info("账户待重提创意开始创建,accountId:{}", accountId);
+                kuaiShouDimensionCreativeService.againCreateCreative(accountId, token.getAccessToken());
+            }
+        });
+    }
+
+
+    @ApiOperation(value = "多维度测试关联创意-分页列表查询", notes = "多维度测试关联创意-分页列表查询")
+    @GetMapping(value = "/getCreativeList")
+    public Result<List<KuaiShouDimensionCreative>> getCreativeList(String unitTableId) {
+        Result<List<KuaiShouDimensionCreative>> result = new Result<>();
+        QueryWrapper<KuaiShouDimensionCreative> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("unit_table_id", unitTableId);
+        List<KuaiShouDimensionCreative> list = kuaiShouDimensionCreativeService.list(queryWrapper);
+        for (KuaiShouDimensionCreative creative : list) {
+            JSONObject videoJson = videoGetService.getVideoByPhotoIdAndAccountId(creative.getAccountId(), creative.getPhotoId());
+            if (!Check.isNull(videoJson)) {
+                creative.setCoverUrl(videoJson.getString("coverUrl"));
+                creative.setPhotoUrl(videoJson.getString("photoUrl"));
+            }
+        }
+
+        result.setSuccess(true);
+        result.setResult(list);
+        return result;
+    }
+
+    /**
+     * 添加
+     *
+     * @param kuaiShouDimensionCreative
+     * @return
+     */
+    @ApiOperation(value = "多维度测试关联创意-添加", notes = "多维度测试关联创意-添加")
+    @PostMapping(value = "/add")
+    public Result<KuaiShouDimensionCreative> add(@RequestBody KuaiShouDimensionCreative kuaiShouDimensionCreative) {
+        Result<KuaiShouDimensionCreative> result = new Result<>();
+        try {
+            kuaiShouDimensionCreativeService.save(kuaiShouDimensionCreative);
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+
+    /**
+     * 编辑
+     *
+     * @param kuaiShouDimensionCreative
+     * @return
+     */
+    @ApiOperation(value = "多维度测试关联创意-编辑", notes = "多维度测试关联创意-编辑")
+    @PutMapping(value = "/edit")
+    public Result<KuaiShouDimensionCreative> edit(@RequestBody KuaiShouDimensionCreative kuaiShouDimensionCreative) {
+        Result<KuaiShouDimensionCreative> result = new Result<KuaiShouDimensionCreative>();
+        KuaiShouDimensionCreative kuaiShouDimensionCreativeEntity = kuaiShouDimensionCreativeService.getById(kuaiShouDimensionCreative.getId());
+        if (kuaiShouDimensionCreativeEntity == null) {
+            result.error500("未找到对应实体");
+        } else {
+            boolean ok = kuaiShouDimensionCreativeService.updateById(kuaiShouDimensionCreative);
+            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 {
+            kuaiShouDimensionCreativeService.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<KuaiShouDimensionCreative> deleteBatch(@RequestParam(name = "ids") String ids) {
+        Result<KuaiShouDimensionCreative> result = new Result<>();
+        if (ids == null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        } else {
+            this.kuaiShouDimensionCreativeService.removeByIds(Arrays.asList(ids.split(",")));
+            result.success("删除成功!");
+        }
+        return result;
+    }
+
+    /**
+     * 通过id查询
+     *
+     * @param id
+     * @return
+     */
+    @ApiOperation(value = "多维度测试关联创意-通过id查询", notes = "多维度测试关联创意-通过id查询")
+    @GetMapping(value = "/queryById")
+    public Result<KuaiShouDimensionCreative> queryById(@RequestParam(name = "id", required = true) String id) {
+        Result<KuaiShouDimensionCreative> result = new Result<>();
+        KuaiShouDimensionCreative kuaiShouDimensionCreative = kuaiShouDimensionCreativeService.getById(id);
+        if (kuaiShouDimensionCreative == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(kuaiShouDimensionCreative);
+            result.setSuccess(true);
+        }
+        return result;
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param response
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+        // Step.1 组装查询条件
+        QueryWrapper<KuaiShouDimensionCreative> queryWrapper = null;
+        try {
+            String paramsStr = request.getParameter("paramsStr");
+            if (oConvertUtils.isNotEmpty(paramsStr)) {
+                String deString = URLDecoder.decode(paramsStr, "UTF-8");
+                KuaiShouDimensionCreative kuaiShouDimensionCreative = JSON.parseObject(deString, KuaiShouDimensionCreative.class);
+                queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouDimensionCreative, request.getParameterMap());
+            }
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+
+        //Step.2 AutoPoi 导出Excel
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        List<KuaiShouDimensionCreative> pageList = kuaiShouDimensionCreativeService.list(queryWrapper);
+        //导出文件名称
+        mv.addObject(NormalExcelConstants.FILE_NAME, "多维度测试关联创意列表");
+        mv.addObject(NormalExcelConstants.CLASS, KuaiShouDimensionCreative.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<KuaiShouDimensionCreative> listKuaiShouDimensionCreatives = ExcelImportUtil.importExcel(file.getInputStream(), KuaiShouDimensionCreative.class, params);
+                kuaiShouDimensionCreativeService.saveBatch(listKuaiShouDimensionCreatives);
+                return Result.ok("文件导入成功!数据行数:" + listKuaiShouDimensionCreatives.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("文件导入失败!");
+    }
+
+}

+ 282 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/controller/KuaiShouDimensionMaterialController.java

@@ -0,0 +1,282 @@
+package cn.com.ctop.kuaishou.modules.dimension.controller;
+
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.common.module.utils.QueryGenerator;
+import cn.com.ctop.kuaishou.modules.dimension.entity.KuaiShouDimensionMaterial;
+import cn.com.ctop.kuaishou.modules.dimension.service.IKuaiShouDimensionMaterialService;
+import com.alibaba.fastjson.JSON;
+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.PageInfo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.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.*;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+import org.springframework.web.servlet.ModelAndView;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 多维度测试素材列表
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2021-07-23
+ */
+@Slf4j
+@Api(tags = "多维度测试素材列表")
+@RestController
+@RequestMapping("/dimension/kuaiShouDimensionMaterial")
+public class KuaiShouDimensionMaterialController {
+    @Autowired
+    private IKuaiShouDimensionMaterialService kuaiShouDimensionMaterialService;
+
+
+    @ApiOperation(value = "多维度测试素材列表-添加", notes = "多维度测试素材列表-添加")
+    @PostMapping(value = "/getVideoList")
+    public Result<PageInfo<List<JSONObject>>> getVideoList(@RequestBody JSONObject requestJson) {
+        Result<PageInfo<List<JSONObject>>> result = new Result<>();
+        try {
+            Long id = requestJson.getLong("id");
+            if (Check.isNull(id)) {
+                throw new Exception("策略id不能为空");
+            }
+            Long accountId = requestJson.getLong("accountId");
+            if (Check.isNull(accountId)) {
+                throw new Exception("账户id不能为空");
+            }
+            Map<String, Object> requestMap = new HashMap<>();
+            requestMap.put("strategyId", id);
+            requestMap.put("accountId", accountId);
+
+            String startDate = requestJson.getString("startDate");
+            String endDate = requestJson.getString("endDate");
+            if (!Check.isNull(startDate) && !Check.isNull(endDate)) {
+                requestMap.put("startDate", startDate + " 00:00:01");
+                requestMap.put("endDate", endDate + " 23:59:59");
+            }
+            Integer pageNo = requestJson.getInteger("pageNo");
+            Integer pageSize = requestJson.getInteger("pageSize");
+            PageInfo<List<JSONObject>> videoList = kuaiShouDimensionMaterialService.getVideoList(requestMap, pageNo, pageSize);
+            result.success("查询成功");
+            result.setResult(videoList);
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("查询失败");
+        }
+        return result;
+    }
+
+
+    /**
+     * 分页列表查询
+     *
+     * @param kuaiShouDimensionMaterial
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @ApiOperation(value = "多维度测试素材列表-分页列表查询", notes = "多维度测试素材列表-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<IPage<KuaiShouDimensionMaterial>> queryPageList(KuaiShouDimensionMaterial kuaiShouDimensionMaterial,
+                                                                  @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                                  @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                                  HttpServletRequest req) {
+        Result<IPage<KuaiShouDimensionMaterial>> result = new Result<>();
+        QueryWrapper<KuaiShouDimensionMaterial> queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouDimensionMaterial, req.getParameterMap());
+        Page<KuaiShouDimensionMaterial> page = new Page<KuaiShouDimensionMaterial>(pageNo, pageSize);
+        IPage<KuaiShouDimensionMaterial> pageList = kuaiShouDimensionMaterialService.page(page, queryWrapper);
+        result.setSuccess(true);
+        result.setResult(pageList);
+        return result;
+    }
+
+    /**
+     * 添加
+     *
+     * @param kuaiShouDimensionMaterial
+     * @return
+     */
+    @ApiOperation(value = "多维度测试素材列表-添加", notes = "多维度测试素材列表-添加")
+    @PostMapping(value = "/add")
+    public Result<KuaiShouDimensionMaterial> add(@RequestBody KuaiShouDimensionMaterial kuaiShouDimensionMaterial) {
+        Result<KuaiShouDimensionMaterial> result = new Result<>();
+        try {
+            kuaiShouDimensionMaterialService.save(kuaiShouDimensionMaterial);
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+
+    /**
+     * 编辑
+     *
+     * @param kuaiShouDimensionMaterial
+     * @return
+     */
+    @ApiOperation(value = "多维度测试素材列表-编辑", notes = "多维度测试素材列表-编辑")
+    @PutMapping(value = "/edit")
+    public Result<KuaiShouDimensionMaterial> edit(@RequestBody KuaiShouDimensionMaterial kuaiShouDimensionMaterial) {
+        Result<KuaiShouDimensionMaterial> result = new Result<KuaiShouDimensionMaterial>();
+        KuaiShouDimensionMaterial kuaiShouDimensionMaterialEntity = kuaiShouDimensionMaterialService.getById(kuaiShouDimensionMaterial.getId());
+        if (kuaiShouDimensionMaterialEntity == null) {
+            result.error500("未找到对应实体");
+        } else {
+            boolean ok = kuaiShouDimensionMaterialService.updateById(kuaiShouDimensionMaterial);
+            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 {
+            kuaiShouDimensionMaterialService.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<KuaiShouDimensionMaterial> deleteBatch(@RequestParam(name = "ids") String ids) {
+        Result<KuaiShouDimensionMaterial> result = new Result<>();
+        if (ids == null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        } else {
+            this.kuaiShouDimensionMaterialService.removeByIds(Arrays.asList(ids.split(",")));
+            result.success("删除成功!");
+        }
+        return result;
+    }
+
+    /**
+     * 通过id查询
+     *
+     * @param id
+     * @return
+     */
+    @ApiOperation(value = "多维度测试素材列表-通过id查询", notes = "多维度测试素材列表-通过id查询")
+    @GetMapping(value = "/queryById")
+    public Result<KuaiShouDimensionMaterial> queryById(@RequestParam(name = "id", required = true) String id) {
+        Result<KuaiShouDimensionMaterial> result = new Result<>();
+        KuaiShouDimensionMaterial kuaiShouDimensionMaterial = kuaiShouDimensionMaterialService.getById(id);
+        if (kuaiShouDimensionMaterial == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(kuaiShouDimensionMaterial);
+            result.setSuccess(true);
+        }
+        return result;
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param response
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+        // Step.1 组装查询条件
+        QueryWrapper<KuaiShouDimensionMaterial> queryWrapper = null;
+        try {
+            String paramsStr = request.getParameter("paramsStr");
+            if (oConvertUtils.isNotEmpty(paramsStr)) {
+                String deString = URLDecoder.decode(paramsStr, "UTF-8");
+                KuaiShouDimensionMaterial kuaiShouDimensionMaterial = JSON.parseObject(deString, KuaiShouDimensionMaterial.class);
+                queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouDimensionMaterial, request.getParameterMap());
+            }
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+
+        //Step.2 AutoPoi 导出Excel
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        List<KuaiShouDimensionMaterial> pageList = kuaiShouDimensionMaterialService.list(queryWrapper);
+        //导出文件名称
+        mv.addObject(NormalExcelConstants.FILE_NAME, "多维度测试素材列表列表");
+        mv.addObject(NormalExcelConstants.CLASS, KuaiShouDimensionMaterial.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<KuaiShouDimensionMaterial> listKuaiShouDimensionMaterials = ExcelImportUtil.importExcel(file.getInputStream(), KuaiShouDimensionMaterial.class, params);
+                kuaiShouDimensionMaterialService.saveBatch(listKuaiShouDimensionMaterials);
+                return Result.ok("文件导入成功!数据行数:" + listKuaiShouDimensionMaterials.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("文件导入失败!");
+    }
+
+}

+ 227 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/controller/KuaiShouDimensionRegionConfigController.java

@@ -0,0 +1,227 @@
+package cn.com.ctop.kuaishou.modules.dimension.controller;
+
+import cn.com.ctop.common.module.utils.QueryGenerator;
+import cn.com.ctop.kuaishou.modules.dimension.entity.KuaiShouDimensionRegionConfig;
+import cn.com.ctop.kuaishou.modules.dimension.service.IKuaiShouDimensionRegionConfigService;
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.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.*;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+import org.springframework.web.servlet.ModelAndView;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 地域配置
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2021-07-21
+ */
+@Slf4j
+@Api(tags = "地域配置")
+@RestController
+@RequestMapping("/dimension/kuaiShouDimensionRegionConfig")
+public class KuaiShouDimensionRegionConfigController {
+    @Autowired
+    private IKuaiShouDimensionRegionConfigService kuaiShouDimensionRegionConfigService;
+
+
+    @ApiOperation(value = "地域配置-分页列表查询", notes = "地域配置-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<List<KuaiShouDimensionRegionConfig>> queryPageList() {
+        Result<List<KuaiShouDimensionRegionConfig>> result = new Result<>();
+        QueryWrapper<KuaiShouDimensionRegionConfig> queryWrapper = new QueryWrapper<>();
+        List<KuaiShouDimensionRegionConfig> list = kuaiShouDimensionRegionConfigService.list(queryWrapper);
+        result.setSuccess(true);
+        result.setResult(list);
+        return result;
+    }
+
+    /**
+     * 添加
+     *
+     * @param kuaiShouDimensionRegionConfig
+     * @return
+     */
+    @ApiOperation(value = "地域配置-添加", notes = "地域配置-添加")
+    @PostMapping(value = "/add")
+    public Result<KuaiShouDimensionRegionConfig> add(@RequestBody KuaiShouDimensionRegionConfig kuaiShouDimensionRegionConfig) {
+        Result<KuaiShouDimensionRegionConfig> result = new Result<>();
+        try {
+            kuaiShouDimensionRegionConfigService.save(kuaiShouDimensionRegionConfig);
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+
+    /**
+     * 编辑
+     *
+     * @param kuaiShouDimensionRegionConfig
+     * @return
+     */
+    @ApiOperation(value = "地域配置-编辑", notes = "地域配置-编辑")
+    @PutMapping(value = "/edit")
+    public Result<KuaiShouDimensionRegionConfig> edit(@RequestBody KuaiShouDimensionRegionConfig kuaiShouDimensionRegionConfig) {
+        Result<KuaiShouDimensionRegionConfig> result = new Result<KuaiShouDimensionRegionConfig>();
+        KuaiShouDimensionRegionConfig kuaiShouDimensionRegionConfigEntity = kuaiShouDimensionRegionConfigService.getById(kuaiShouDimensionRegionConfig.getId());
+        if (kuaiShouDimensionRegionConfigEntity == null) {
+            result.error500("未找到对应实体");
+        } else {
+            boolean ok = kuaiShouDimensionRegionConfigService.updateById(kuaiShouDimensionRegionConfig);
+            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 {
+            kuaiShouDimensionRegionConfigService.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<KuaiShouDimensionRegionConfig> deleteBatch(@RequestParam(name = "ids") String ids) {
+        Result<KuaiShouDimensionRegionConfig> result = new Result<>();
+        if (ids == null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        } else {
+            this.kuaiShouDimensionRegionConfigService.removeByIds(Arrays.asList(ids.split(",")));
+            result.success("删除成功!");
+        }
+        return result;
+    }
+
+    /**
+     * 通过id查询
+     *
+     * @param id
+     * @return
+     */
+    @ApiOperation(value = "地域配置-通过id查询", notes = "地域配置-通过id查询")
+    @GetMapping(value = "/queryById")
+    public Result<KuaiShouDimensionRegionConfig> queryById(@RequestParam(name = "id", required = true) String id) {
+        Result<KuaiShouDimensionRegionConfig> result = new Result<>();
+        KuaiShouDimensionRegionConfig kuaiShouDimensionRegionConfig = kuaiShouDimensionRegionConfigService.getById(id);
+        if (kuaiShouDimensionRegionConfig == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(kuaiShouDimensionRegionConfig);
+            result.setSuccess(true);
+        }
+        return result;
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param response
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+        // Step.1 组装查询条件
+        QueryWrapper<KuaiShouDimensionRegionConfig> queryWrapper = null;
+        try {
+            String paramsStr = request.getParameter("paramsStr");
+            if (oConvertUtils.isNotEmpty(paramsStr)) {
+                String deString = URLDecoder.decode(paramsStr, "UTF-8");
+                KuaiShouDimensionRegionConfig kuaiShouDimensionRegionConfig = JSON.parseObject(deString, KuaiShouDimensionRegionConfig.class);
+                queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouDimensionRegionConfig, request.getParameterMap());
+            }
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+
+        //Step.2 AutoPoi 导出Excel
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        List<KuaiShouDimensionRegionConfig> pageList = kuaiShouDimensionRegionConfigService.list(queryWrapper);
+        //导出文件名称
+        mv.addObject(NormalExcelConstants.FILE_NAME, "地域配置列表");
+        mv.addObject(NormalExcelConstants.CLASS, KuaiShouDimensionRegionConfig.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<KuaiShouDimensionRegionConfig> listKuaiShouDimensionRegionConfigs = ExcelImportUtil.importExcel(file.getInputStream(), KuaiShouDimensionRegionConfig.class, params);
+                kuaiShouDimensionRegionConfigService.saveBatch(listKuaiShouDimensionRegionConfigs);
+                return Result.ok("文件导入成功!数据行数:" + listKuaiShouDimensionRegionConfigs.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("文件导入失败!");
+    }
+
+}

+ 238 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/controller/KuaiShouDimensionRegionDetailController.java

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

+ 455 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/controller/KuaiShouDimensionStrategyController.java

@@ -0,0 +1,455 @@
+package cn.com.ctop.kuaishou.modules.dimension.controller;
+
+import cn.com.ctop.common.module.entity.UserAllocation;
+import cn.com.ctop.common.module.service.ISysRoleExtService;
+import cn.com.ctop.common.module.service.IUserAllocationService;
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.common.module.utils.QueryGenerator;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouAppList;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouAppListService;
+import cn.com.ctop.kuaishou.modules.dimension.entity.KuaiShouDimensionAccount;
+import cn.com.ctop.kuaishou.modules.dimension.entity.KuaiShouDimensionMaterial;
+import cn.com.ctop.kuaishou.modules.dimension.entity.KuaiShouDimensionStrategy;
+import cn.com.ctop.kuaishou.modules.dimension.service.IKuaiShouDimensionAccountService;
+import cn.com.ctop.kuaishou.modules.dimension.service.IKuaiShouDimensionMaterialService;
+import cn.com.ctop.kuaishou.modules.dimension.service.IKuaiShouDimensionStrategyService;
+import cn.com.ctop.kuaishou.modules.dimension.service.IKuaiShouDimensionVariableService;
+import cn.com.ctop.kuaishou.modules.report.service.IEtlKuaishouReportAccountDailyService;
+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.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.shiro.SecurityUtils;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.system.vo.LoginUser;
+import org.jeecg.common.util.DateUtils;
+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.*;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+import org.springframework.web.servlet.ModelAndView;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 多维度测试策略表
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2021-07-19
+ */
+@Slf4j
+@Api(tags = "多维度测试策略表")
+@RestController
+@RequestMapping("/dimension/kuaiShouDimensionStrategy")
+public class KuaiShouDimensionStrategyController {
+    @Autowired
+    private IKuaiShouDimensionStrategyService kuaiShouDimensionStrategyService;
+    @Autowired
+    private IKuaiShouDimensionAccountService kuaiShouDimensionAccountService;
+    @Autowired
+    private IKuaiShouDimensionVariableService variableService;
+    @Autowired
+    private IUserAllocationService userAllocationService;
+    @Autowired
+    private IEtlKuaishouReportAccountDailyService reportAccountDailyService;
+    @Autowired
+    private IKuaiShouDimensionMaterialService dimensionMaterialService;
+    @Autowired
+    private IKuaiShouAppListService appListService;
+    @Autowired
+    private ISysRoleExtService sysRoleService;
+
+
+    @GetMapping(value = "/checkStrategyName")
+    public Result<Boolean> checkStrategyName(String strategyName, Long id) {
+        Result<Boolean> result = new Result<>();
+        try {
+            if (Check.isNull(strategyName)) {
+                throw new Exception("入参不能为空");
+            }
+            QueryWrapper<KuaiShouDimensionStrategy> dimensionStrategyQueryWrapper = new QueryWrapper<>();
+            dimensionStrategyQueryWrapper.eq("strategy_name", strategyName);
+            dimensionStrategyQueryWrapper.last("limit 1");
+            KuaiShouDimensionStrategy one = kuaiShouDimensionStrategyService.getOne(dimensionStrategyQueryWrapper);
+            Boolean trueOrFalse = false;
+            if (!Check.isNull(one)) {
+                if (one.getId() != id) {
+                    trueOrFalse = true;
+                }
+
+            }
+
+            result.setResult(trueOrFalse);
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+
+
+    @ApiOperation(value = "多维度测试策略表-添加", notes = "多维度测试策略表-添加")
+    @PostMapping(value = "/create")
+    public Result<JSONObject> create(@RequestBody JSONObject requestJson) {
+        Result<JSONObject> result = new Result<>();
+        try {
+            if (Check.isNull(requestJson)) {
+                throw new Exception("入参不能为空");
+            }
+            Long id = requestJson.getLong("id");
+            if (Check.isNull(id)) {
+                throw new Exception("策略id不能为空");
+            }
+            JSONArray materialArray = requestJson.getJSONArray("materialArray");
+            if (Check.isNull(materialArray)) {
+                throw new Exception("请选择需要创建的素材");
+            }
+
+            List<KuaiShouDimensionMaterial> dimensionMaterials = new ArrayList<>();
+
+            for (int i = 0; i < materialArray.size(); i++) {
+                Long photoId = materialArray.getLong(i);
+                KuaiShouDimensionMaterial addMaterial = new KuaiShouDimensionMaterial();
+                addMaterial.setStrategyId(id);
+                addMaterial.setPhotoId(photoId);
+           /*  String signature = dimensionMaterialService.getSignatureByPhotoId(photoId);
+                if (!Check.isNull(signature)) {
+                    addMaterial.setSignature(signature);
+                }*/
+                dimensionMaterials.add(addMaterial);
+            }
+
+            dimensionMaterialService.addBatch(dimensionMaterials);
+            JSONObject returnJson = kuaiShouDimensionStrategyService.create(id, materialArray);
+            result.setResult(returnJson);
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+
+
+    /**
+     * 分页列表查询
+     *
+     * @param kuaiShouDimensionStrategy
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @ApiOperation(value = "多维度测试策略表-分页列表查询", notes = "多维度测试策略表-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<IPage<KuaiShouDimensionStrategy>> queryPageList(KuaiShouDimensionStrategy kuaiShouDimensionStrategy,
+                                                                  @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                                  @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                                  HttpServletRequest req) {
+        Result<IPage<KuaiShouDimensionStrategy>> result = new Result<>();
+        String strategyName = kuaiShouDimensionStrategy.getStrategyName();
+        kuaiShouDimensionStrategy.setStrategyName(null);
+        String startDate = kuaiShouDimensionStrategy.getStartDate();
+        String endDate = kuaiShouDimensionStrategy.getEndDate();
+        if (Check.isNull(startDate) || Check.isNull(endDate)) {
+            String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
+            startDate = nowDate;
+            endDate = nowDate;
+        }
+        QueryWrapper<KuaiShouDimensionStrategy> queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouDimensionStrategy, req.getParameterMap());
+        if (!Check.isNull(strategyName)) {
+            queryWrapper.like("strategy_name", strategyName);
+        }
+        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+        String roleCode = sysRoleService.getRoleCodeByUserId(sysUser.getId());
+        if (!roleCode.equals("admin")) {
+            queryWrapper.eq("user_id", sysUser.getId());
+        }
+
+        queryWrapper.orderByDesc("create_time");
+        Page<KuaiShouDimensionStrategy> page = new Page<KuaiShouDimensionStrategy>(pageNo, pageSize);
+        IPage<KuaiShouDimensionStrategy> pageList = kuaiShouDimensionStrategyService.page(page, queryWrapper);
+        List<KuaiShouDimensionStrategy> records = pageList.getRecords();
+        if (!Check.isNull(records)) {
+            for (KuaiShouDimensionStrategy strategy : records) {
+                Long id = strategy.getId();
+                List<KuaiShouDimensionAccount> accountList = kuaiShouDimensionAccountService.getListByStrategyId(id, null);
+                if (Check.isNull(accountList)) {
+                    continue;
+                }
+                JSONArray accountIds = new JSONArray(); // 需要查询报表数据的账户集合
+                for (KuaiShouDimensionAccount account : accountList) {
+                    accountIds.add(account.getAccountId());
+                }
+                if (!Check.isNull(accountIds)) {
+                    JSONObject dataJson = reportAccountDailyService.getReportData(startDate, endDate, accountIds);
+                    strategy.setReportData(dataJson);
+                }
+            }
+        }
+        result.setSuccess(true);
+        result.setResult(pageList);
+        return result;
+    }
+
+    /**
+     * 添加
+     *
+     * @param strategyJson
+     * @return
+     */
+    @ApiOperation(value = "多维度测试策略表-添加", notes = "多维度测试策略表-添加")
+    @PostMapping(value = "/insertOrUpdate")
+    public Result<KuaiShouDimensionStrategy> add(@RequestBody JSONObject strategyJson) {
+        Result<KuaiShouDimensionStrategy> result = new Result<>();
+        try {
+            if (Check.isNull(strategyJson)) {
+                throw new Exception("策略配置不能为空");
+            }
+
+            JSONArray appInfoArray = strategyJson.getJSONArray("appInfoArray");
+            if (Check.isNull(appInfoArray)) {
+                throw new Exception("策略配置应用不能为空");
+            }
+
+            LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+
+
+            kuaiShouDimensionStrategyService.insertStrategy(sysUser.getId(), strategyJson);
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+
+    /**
+     * 编辑
+     *
+     * @param kuaiShouDimensionStrategy
+     * @return
+     */
+    @ApiOperation(value = "多维度测试策略表-编辑", notes = "多维度测试策略表-编辑")
+    @PostMapping(value = "/edit")
+    public Result<KuaiShouDimensionStrategy> edit(@RequestBody KuaiShouDimensionStrategy kuaiShouDimensionStrategy) {
+        Result<KuaiShouDimensionStrategy> result = new Result<KuaiShouDimensionStrategy>();
+        KuaiShouDimensionStrategy kuaiShouDimensionStrategyEntity = kuaiShouDimensionStrategyService.getById(kuaiShouDimensionStrategy.getId());
+        if (kuaiShouDimensionStrategyEntity == null) {
+            result.error500("未找到对应实体");
+        } else {
+            boolean ok = kuaiShouDimensionStrategyService.updateById(kuaiShouDimensionStrategy);
+            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 {
+            kuaiShouDimensionStrategyService.removeById(id);
+            kuaiShouDimensionAccountService.removeByStrategyId(id);
+            variableService.removeByStrategyId(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<KuaiShouDimensionStrategy> deleteBatch(@RequestParam(name = "ids") String ids) {
+        Result<KuaiShouDimensionStrategy> result = new Result<>();
+        if (ids == null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        } else {
+            this.kuaiShouDimensionStrategyService.removeByIds(Arrays.asList(ids.split(",")));
+            result.success("删除成功!");
+        }
+        return result;
+    }
+
+    /**
+     * 通过id查询
+     *
+     * @param id
+     * @return
+     */
+    @ApiOperation(value = "多维度测试策略表-通过id查询", notes = "多维度测试策略表-通过id查询")
+    @GetMapping(value = "/queryById")
+    public Result<KuaiShouDimensionStrategy> queryById(@RequestParam(name = "id", required = true) Long id) {
+        Result<KuaiShouDimensionStrategy> result = new Result<>();
+        KuaiShouDimensionStrategy kuaiShouDimensionStrategy = kuaiShouDimensionStrategyService.getById(id);
+        if (kuaiShouDimensionStrategy == null) {
+            result.error500("未找到对应实体");
+        } else {
+            List<KuaiShouDimensionAccount> accountList = kuaiShouDimensionAccountService.getListByStrategyId(id, null);
+            if (!Check.isNull(accountList)) {
+                JSONArray accountIds = new JSONArray(); // 需要查询报表数据的账户集合
+                JSONArray appInfoArray = new JSONArray();
+                JSONArray creativeArray = new JSONArray();
+                JSONArray crowdArray = new JSONArray();
+                for (KuaiShouDimensionAccount account : accountList) {
+                    accountIds.add(account.getAccountId());
+                    UserAllocation accountInfo = userAllocationService.getByAccountId(account.getAccountId());
+                    JSONObject appInfo = new JSONObject();
+                    appInfo.put("accountId", account.getAccountId());
+                    if (!Check.isNull(accountInfo)) {
+                        appInfo.put("accountName", accountInfo.getAuthName());
+                    }
+                    appInfo.put("accountStatus", account.getAccountStatus());
+                    appInfo.put("appId", account.getAppId());
+                    appInfo.put("clickTrackUrl", account.getClickTrackUrl());
+                    appInfo.put("actionbarClickUrl", account.getActionbarClickUrl());
+                    appInfo.put("useSchemaUri", account.getUseSchemaUri());
+                    if (!Check.isNull(account.getSchemaUri())) {
+                        appInfo.put("schemaUri", account.getSchemaUri());
+                    }
+                    KuaiShouAppList kuaiShouAppInfo = appListService.getAppInfo(account.getAccountId(), account.getAppId());
+                    if (!Check.isNull(kuaiShouAppInfo)) {
+                        appInfo.put("appName", kuaiShouAppInfo.getAppName());
+                        appInfo.put("appVersion", kuaiShouAppInfo.getAppVersion());
+                        appInfo.put("platform", kuaiShouAppInfo.getPlatform());
+                    }
+                    appInfoArray.add(appInfo);
+                    JSONObject creative = new JSONObject();
+                    creative.put("accountId", account.getAccountId());
+                    if (!Check.isNull(accountInfo)) {
+                        creative.put("accountName", accountInfo.getAuthName());
+                    }
+                    creative.put("creativeCategory", account.getCreativeCategory());
+                    creative.put("creativeTag", account.getCreativeTag());
+                    creativeArray.add(creative);
+
+                    JSONObject crowd = new JSONObject();
+                    crowd.put("accountId", account);
+                    if (!Check.isNull(accountInfo)) {
+                        crowd.put("accountName", accountInfo.getAuthName());
+                    }
+                    if (!Check.isNull(account.getPopulation())) {
+                        crowd.put("population", JSONArray.parseArray(account.getPopulation()));
+                    }
+                    if (!Check.isNull(account.getExcludePopulation())) {
+                        crowd.put("excludePopulation", JSONArray.parseArray(account.getExcludePopulation()));
+                    }
+                    if (!Check.isNull(account.getPaidAudience())) {
+                        crowd.put("paidAudience", JSONArray.parseArray(account.getPaidAudience()));
+                    }
+                    crowdArray.add(crowd);
+                }
+                kuaiShouDimensionStrategy.setAppInfoArray(appInfoArray);
+                kuaiShouDimensionStrategy.setCreativeArray(creativeArray);
+                kuaiShouDimensionStrategy.setCrowdArray(crowdArray);
+            }
+            result.setResult(kuaiShouDimensionStrategy);
+            result.setSuccess(true);
+        }
+        return result;
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param response
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+        // Step.1 组装查询条件
+        QueryWrapper<KuaiShouDimensionStrategy> queryWrapper = null;
+        try {
+            String paramsStr = request.getParameter("paramsStr");
+            if (oConvertUtils.isNotEmpty(paramsStr)) {
+                String deString = URLDecoder.decode(paramsStr, "UTF-8");
+                KuaiShouDimensionStrategy kuaiShouDimensionStrategy = JSON.parseObject(deString, KuaiShouDimensionStrategy.class);
+                queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouDimensionStrategy, request.getParameterMap());
+            }
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+
+        //Step.2 AutoPoi 导出Excel
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        List<KuaiShouDimensionStrategy> pageList = kuaiShouDimensionStrategyService.list(queryWrapper);
+        //导出文件名称
+        mv.addObject(NormalExcelConstants.FILE_NAME, "多维度测试策略表列表");
+        mv.addObject(NormalExcelConstants.CLASS, KuaiShouDimensionStrategy.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<KuaiShouDimensionStrategy> listKuaiShouDimensionStrategys = ExcelImportUtil.importExcel(file.getInputStream(), KuaiShouDimensionStrategy.class, params);
+                kuaiShouDimensionStrategyService.saveBatch(listKuaiShouDimensionStrategys);
+                return Result.ok("文件导入成功!数据行数:" + listKuaiShouDimensionStrategys.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("文件导入失败!");
+    }
+
+}

+ 356 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/controller/KuaiShouDimensionUnitController.java

@@ -0,0 +1,356 @@
+package cn.com.ctop.kuaishou.modules.dimension.controller;
+
+import cn.com.ctop.common.module.entity.UserAllocation;
+import cn.com.ctop.common.module.service.IUserAllocationService;
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.common.module.utils.QueryGenerator;
+import cn.com.ctop.kuaishou.modules.dimension.entity.KuaiShouDimensionAccount;
+import cn.com.ctop.kuaishou.modules.dimension.entity.KuaiShouDimensionUnit;
+import cn.com.ctop.kuaishou.modules.dimension.service.IKuaiShouDimensionAccountService;
+import cn.com.ctop.kuaishou.modules.dimension.service.IKuaiShouDimensionCreativeService;
+import cn.com.ctop.kuaishou.modules.dimension.service.IKuaiShouDimensionUnitService;
+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.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.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.*;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+import org.springframework.web.servlet.ModelAndView;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 多维度测试组列表
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2021-07-22
+ */
+@Slf4j
+@Api(tags = " 多维度测试组列表")
+@RestController
+@RequestMapping("/dimension/kuaiShouDimensionUnit")
+public class KuaiShouDimensionUnitController {
+    @Autowired
+    private IKuaiShouDimensionUnitService kuaiShouDimensionUnitService;
+    @Autowired
+    private IKuaiShouDimensionAccountService dimensionAccountService;
+    @Autowired
+    private IUserAllocationService userAllocationService;
+    @Autowired
+    private IKuaiShouDimensionCreativeService dimensionCreativeService;
+
+    /**
+     * 预览
+     *
+     * @param strategyId
+     * @return
+     */
+    @GetMapping(value = "/previewByStrategyId")
+    public Result<JSONArray> previewByStrategy_id(Long strategyId) {
+        Result<JSONArray> result = new Result<>();
+        try {
+            JSONArray array = new JSONArray();
+            List<KuaiShouDimensionAccount> accountList = dimensionAccountService.getListByStrategyId(strategyId, 0);
+            if (!Check.isNull(accountList)) {
+                for (KuaiShouDimensionAccount account : accountList) {
+                    UserAllocation accountInfo = userAllocationService.getByAccountId(account.getAccountId());
+                    JSONObject jsonInfo = new JSONObject();
+                    jsonInfo.put("accountId", account.getAccountId());
+                    if (!Check.isNull(accountInfo)) {
+                        jsonInfo.put("authName", accountInfo.getAuthName());
+                    }
+                    List<JSONObject> campaignList = kuaiShouDimensionUnitService.getCampaignCount(account.getAccountId(), strategyId);
+                    jsonInfo.put("campaignCount", campaignList.size());
+                    Integer unitCount = kuaiShouDimensionUnitService.getUnitCount(account.getAccountId(), strategyId);
+                    jsonInfo.put("unitCount", unitCount);
+                    for (int i = 0; i < campaignList.size(); i++) {
+                        JSONObject campaignJson = campaignList.get(i);
+                        List<KuaiShouDimensionUnit> unitList = kuaiShouDimensionUnitService.getUnitListBy(strategyId, account.getAccountId(), campaignJson.getLong("campaignId"));
+                        campaignJson.put("unitDetail", unitList);
+                        //
+                    }
+                    jsonInfo.put("campaignInfo", campaignList);
+                    array.add(jsonInfo);
+                }
+            }
+            result.setSuccess(true);
+            result.setResult(array);
+        } catch (Exception e) {
+            result.setSuccess(false);
+            result.setResult(null);
+        }
+
+        return result;
+    }
+
+
+    /**
+     * 分页列表查询
+     *
+     * @param kuaiShouDimensionUnit
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @ApiOperation(value = " 多维度测试组列表-分页列表查询", notes = " 多维度测试组列表-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<IPage<KuaiShouDimensionUnit>> queryPageList(KuaiShouDimensionUnit kuaiShouDimensionUnit,
+                                                              @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                              @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                              HttpServletRequest req) {
+        Result<IPage<KuaiShouDimensionUnit>> result = new Result<>();
+        QueryWrapper<KuaiShouDimensionUnit> queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouDimensionUnit, req.getParameterMap());
+        Page<KuaiShouDimensionUnit> page = new Page<KuaiShouDimensionUnit>(pageNo, pageSize);
+        IPage<KuaiShouDimensionUnit> pageList = kuaiShouDimensionUnitService.page(page, queryWrapper);
+        result.setSuccess(true);
+        result.setResult(pageList);
+        return result;
+    }
+
+    /**
+     * 添加
+     *
+     * @param kuaiShouDimensionUnit
+     * @return
+     */
+    @ApiOperation(value = " 多维度测试组列表-添加", notes = " 多维度测试组列表-添加")
+    @PostMapping(value = "/add")
+    public Result<KuaiShouDimensionUnit> add(@RequestBody KuaiShouDimensionUnit kuaiShouDimensionUnit) {
+        Result<KuaiShouDimensionUnit> result = new Result<>();
+        try {
+            kuaiShouDimensionUnitService.save(kuaiShouDimensionUnit);
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+
+    /**
+     * 编辑
+     *
+     * @param kuaiShouDimensionUnit
+     * @return
+     */
+    @ApiOperation(value = " 多维度测试组列表-编辑", notes = " 多维度测试组列表-编辑")
+    @PutMapping(value = "/edit")
+    public Result<KuaiShouDimensionUnit> edit(@RequestBody KuaiShouDimensionUnit kuaiShouDimensionUnit) {
+        Result<KuaiShouDimensionUnit> result = new Result<KuaiShouDimensionUnit>();
+        KuaiShouDimensionUnit kuaiShouDimensionUnitEntity = kuaiShouDimensionUnitService.getById(kuaiShouDimensionUnit.getId());
+        if (kuaiShouDimensionUnitEntity == null) {
+            result.error500("未找到对应实体");
+        } else {
+            boolean ok = kuaiShouDimensionUnitService.updateById(kuaiShouDimensionUnit);
+            if (ok) {
+                result.success("修改成功!");
+            }
+        }
+
+        return result;
+    }
+
+
+    /**
+     * 编辑
+     *
+     * @param
+     * @return
+     */
+    @ApiOperation(value = " 多维度测试组列表-编辑", notes = " 多维度测试组列表-编辑")
+    @PostMapping(value = "/editBatch")
+    public Result<Boolean> editBatch(@RequestBody JSONObject requestJson) {
+        Result<Boolean> result = new Result<>();
+
+        try {
+            Long strategyId = requestJson.getLong("strategyId");
+            if (Check.isNull(strategyId)) {
+                throw new Exception("请输入策略id");
+            }
+            Integer submitStatus = requestJson.getInteger("submitStatus");
+            if (Check.isNull(submitStatus)) {
+                throw new Exception("请输入修改状态");
+            }
+            JSONArray ids = requestJson.getJSONArray("ids");
+            if (Check.isNull(ids)) {
+                throw new Exception("请输入需修改的账户id");
+            }
+            kuaiShouDimensionUnitService.editBatch(submitStatus, ids);
+            Integer countCount = kuaiShouDimensionUnitService.getUnitCountByStrategyId(strategyId);
+            if (countCount > 0) {
+                result.setResult(true);
+            } else {
+                result.setResult(false);
+            }
+            result.setSuccess(true);
+            result.setMessage("编辑成功");
+        } catch (Exception e) {
+            e.printStackTrace();
+            result.setSuccess(false);
+            result.setMessage("编辑失败");
+        }
+
+
+        return result;
+    }
+
+    /**
+     * 通过id删除
+     *
+     * @param id
+     * @return
+     */
+    @ApiOperation(value = " 多维度测试组列表-通过id删除", notes = " 多维度测试组列表-通过id删除")
+    @DeleteMapping(value = "/delete")
+    public Result<?> delete(@RequestParam(name = "id") String id) {
+        try {
+            kuaiShouDimensionUnitService.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<KuaiShouDimensionUnit> deleteBatch(@RequestParam(name = "ids") String ids) {
+        Result<KuaiShouDimensionUnit> result = new Result<>();
+        if (ids == null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        } else {
+            List<String> strings = Arrays.asList(ids.split(","));
+            this.kuaiShouDimensionUnitService.removeByIds(strings);
+            dimensionCreativeService.removeByUnitTableIds(strings);
+
+            result.success("删除成功!");
+        }
+        return result;
+    }
+
+
+    public static void main(String[] args) {
+        String a = "1";
+        List<String> strings = Arrays.asList(a.split(","));
+        System.err.println(strings);
+        JSONArray array = JSONArray.parseArray(strings.toString());
+        System.err.println(array);
+    }
+
+    /**
+     * 通过id查询
+     *
+     * @param id
+     * @return
+     */
+    @ApiOperation(value = " 多维度测试组列表-通过id查询", notes = " 多维度测试组列表-通过id查询")
+    @GetMapping(value = "/queryById")
+    public Result<KuaiShouDimensionUnit> queryById(@RequestParam(name = "id", required = true) String id) {
+        Result<KuaiShouDimensionUnit> result = new Result<>();
+        KuaiShouDimensionUnit kuaiShouDimensionUnit = kuaiShouDimensionUnitService.getById(id);
+        if (kuaiShouDimensionUnit == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(kuaiShouDimensionUnit);
+            result.setSuccess(true);
+        }
+        return result;
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param response
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+        // Step.1 组装查询条件
+        QueryWrapper<KuaiShouDimensionUnit> queryWrapper = null;
+        try {
+            String paramsStr = request.getParameter("paramsStr");
+            if (oConvertUtils.isNotEmpty(paramsStr)) {
+                String deString = URLDecoder.decode(paramsStr, "UTF-8");
+                KuaiShouDimensionUnit kuaiShouDimensionUnit = JSON.parseObject(deString, KuaiShouDimensionUnit.class);
+                queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouDimensionUnit, request.getParameterMap());
+            }
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+
+        //Step.2 AutoPoi 导出Excel
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        List<KuaiShouDimensionUnit> pageList = kuaiShouDimensionUnitService.list(queryWrapper);
+        //导出文件名称
+        mv.addObject(NormalExcelConstants.FILE_NAME, " 多维度测试组列表列表");
+        mv.addObject(NormalExcelConstants.CLASS, KuaiShouDimensionUnit.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<KuaiShouDimensionUnit> listKuaiShouDimensionUnits = ExcelImportUtil.importExcel(file.getInputStream(), KuaiShouDimensionUnit.class, params);
+                kuaiShouDimensionUnitService.saveBatch(listKuaiShouDimensionUnits);
+                return Result.ok("文件导入成功!数据行数:" + listKuaiShouDimensionUnits.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("文件导入失败!");
+    }
+
+}

+ 292 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/controller/KuaiShouDimensionVariableController.java

@@ -0,0 +1,292 @@
+package cn.com.ctop.kuaishou.modules.dimension.controller;
+
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.common.module.utils.QueryGenerator;
+import cn.com.ctop.kuaishou.modules.dimension.entity.KuaiShouDimensionVariable;
+import cn.com.ctop.kuaishou.modules.dimension.service.IKuaiShouDimensionVariableService;
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.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.*;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+import org.springframework.web.servlet.ModelAndView;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 多维度测试变量配置
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2021-07-20
+ */
+@Slf4j
+@Api(tags = "多维度测试变量配置")
+@RestController
+@RequestMapping("/dimension/kuaiShouDimensionVariable")
+public class KuaiShouDimensionVariableController {
+    @Autowired
+    private IKuaiShouDimensionVariableService kuaiShouDimensionVariableService;
+
+    /**
+     * 分页列表查询
+     *
+     * @param kuaiShouDimensionVariable
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @ApiOperation(value = "多维度测试变量配置-分页列表查询", notes = "多维度测试变量配置-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<IPage<KuaiShouDimensionVariable>> queryPageList(KuaiShouDimensionVariable kuaiShouDimensionVariable,
+                                                                  @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                                  @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                                  HttpServletRequest req) {
+        Result<IPage<KuaiShouDimensionVariable>> result = new Result<>();
+        QueryWrapper<KuaiShouDimensionVariable> queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouDimensionVariable, req.getParameterMap());
+        Page<KuaiShouDimensionVariable> page = new Page<KuaiShouDimensionVariable>(pageNo, pageSize);
+        IPage<KuaiShouDimensionVariable> pageList = kuaiShouDimensionVariableService.page(page, queryWrapper);
+        result.setSuccess(true);
+        result.setResult(pageList);
+        return result;
+    }
+
+
+    @ApiOperation(value = "多维度测试变量配置-分页列表查询", notes = "多维度测试变量配置-分页列表查询")
+    @GetMapping(value = "/selectVariableByStrategyId")
+    public Result<KuaiShouDimensionVariable> selectVariableByStrategyId(Long strategyId) {
+        Result<KuaiShouDimensionVariable> result = new Result<>();
+        QueryWrapper<KuaiShouDimensionVariable> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("strategy_id", strategyId);
+        KuaiShouDimensionVariable one = kuaiShouDimensionVariableService.getOne(queryWrapper);
+        result.setSuccess(true);
+        result.setResult(one);
+        return result;
+    }
+
+
+    /**
+     * 添加
+     *
+     * @param kuaiShouDimensionVariable
+     * @return
+     */
+    @ApiOperation(value = "多维度测试变量配置-添加", notes = "多维度测试变量配置-添加")
+    @PostMapping(value = "/add")
+    public Result<KuaiShouDimensionVariable> add(@RequestBody KuaiShouDimensionVariable kuaiShouDimensionVariable) {
+        Result<KuaiShouDimensionVariable> result = new Result<>();
+        try {
+            Long strategyId = kuaiShouDimensionVariable.getStrategyId();
+            if (Check.isNull(strategyId)) {
+                throw new Exception("策略id不能为空");
+            }
+            QueryWrapper<KuaiShouDimensionVariable> queryWrapper = new QueryWrapper<>();
+            queryWrapper.eq("strategy_id", strategyId);
+            queryWrapper.last("limit 1");
+            KuaiShouDimensionVariable one = kuaiShouDimensionVariableService.getOne(queryWrapper);
+            if (!Check.isNull(one)) {
+                throw new Exception("该策略已绑定变量模板");
+            }
+            kuaiShouDimensionVariableService.save(kuaiShouDimensionVariable);
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+
+    /**
+     * 编辑
+     *
+     * @param kuaiShouDimensionVariable
+     * @return
+     */
+    @ApiOperation(value = "多维度测试变量配置-编辑", notes = "多维度测试变量配置-编辑")
+    @PostMapping(value = "/edit")
+    public Result<KuaiShouDimensionVariable> edit(@RequestBody KuaiShouDimensionVariable kuaiShouDimensionVariable) {
+        Result<KuaiShouDimensionVariable> result = new Result<KuaiShouDimensionVariable>();
+        KuaiShouDimensionVariable kuaiShouDimensionVariableEntity = kuaiShouDimensionVariableService.getById(kuaiShouDimensionVariable.getId());
+        if (kuaiShouDimensionVariableEntity == null) {
+            result.error500("未找到对应实体");
+        } else {
+            boolean ok = kuaiShouDimensionVariableService.updateById(kuaiShouDimensionVariable);
+            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 {
+            kuaiShouDimensionVariableService.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<KuaiShouDimensionVariable> deleteBatch(@RequestParam(name = "ids") String ids) {
+        Result<KuaiShouDimensionVariable> result = new Result<>();
+        if (ids == null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        } else {
+            this.kuaiShouDimensionVariableService.removeByIds(Arrays.asList(ids.split(",")));
+            result.success("删除成功!");
+        }
+        return result;
+    }
+
+    /**
+     * 通过id查询
+     *
+     * @param id
+     * @return
+     */
+    @ApiOperation(value = "多维度测试变量配置-通过id查询", notes = "多维度测试变量配置-通过id查询")
+    @GetMapping(value = "/queryById")
+    public Result<KuaiShouDimensionVariable> queryById(@RequestParam(name = "id", required = true) String id) {
+        Result<KuaiShouDimensionVariable> result = new Result<>();
+        KuaiShouDimensionVariable kuaiShouDimensionVariable = kuaiShouDimensionVariableService.getById(id);
+        if (kuaiShouDimensionVariable == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(kuaiShouDimensionVariable);
+            result.setSuccess(true);
+        }
+        return result;
+    }
+
+    /**
+     * 通过id查询
+     *
+     * @param id
+     * @return
+     */
+    @ApiOperation(value = "多维度测试变量配置-通过id查询", notes = "多维度测试变量配置-通过id查询")
+    @GetMapping(value = "/queryByStrategyId")
+    public Result<KuaiShouDimensionVariable> queryByStrategyId(Long strategyId) {
+        Result<KuaiShouDimensionVariable> result = new Result<>();
+        QueryWrapper<KuaiShouDimensionVariable> variableQueryWrapper = new QueryWrapper<>();
+        variableQueryWrapper.eq("strategy_id", strategyId);
+        variableQueryWrapper.last("limit 1");
+        KuaiShouDimensionVariable one = kuaiShouDimensionVariableService.getOne(variableQueryWrapper);
+        //   KuaiShouDimensionVariable kuaiShouDimensionVariable = kuaiShouDimensionVariableService.getById(id);
+        if (one == null) {
+            result.error500("未找到对应实体");
+            result.setResult(null);
+        } else {
+            result.setResult(one);
+            result.setSuccess(true);
+        }
+        return result;
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param response
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+        // Step.1 组装查询条件
+        QueryWrapper<KuaiShouDimensionVariable> queryWrapper = null;
+        try {
+            String paramsStr = request.getParameter("paramsStr");
+            if (oConvertUtils.isNotEmpty(paramsStr)) {
+                String deString = URLDecoder.decode(paramsStr, "UTF-8");
+                KuaiShouDimensionVariable kuaiShouDimensionVariable = JSON.parseObject(deString, KuaiShouDimensionVariable.class);
+                queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouDimensionVariable, request.getParameterMap());
+            }
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+
+        //Step.2 AutoPoi 导出Excel
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        List<KuaiShouDimensionVariable> pageList = kuaiShouDimensionVariableService.list(queryWrapper);
+        //导出文件名称
+        mv.addObject(NormalExcelConstants.FILE_NAME, "多维度测试变量配置列表");
+        mv.addObject(NormalExcelConstants.CLASS, KuaiShouDimensionVariable.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<KuaiShouDimensionVariable> listKuaiShouDimensionVariables = ExcelImportUtil.importExcel(file.getInputStream(), KuaiShouDimensionVariable.class, params);
+                kuaiShouDimensionVariableService.saveBatch(listKuaiShouDimensionVariables);
+                return Result.ok("文件导入成功!数据行数:" + listKuaiShouDimensionVariables.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("文件导入失败!");
+    }
+
+}

+ 90 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/entity/KuaiShouDimensionAccount.java

@@ -0,0 +1,90 @@
+package cn.com.ctop.kuaishou.modules.dimension.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;
+
+/**
+ * 多维度测试关联账户表
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2021-07-19
+ */
+@Data
+@TableName("ctop_kuaishou_dimension_account")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_kuaishou_dimension_account对象", description = "多维度测试关联账户表")
+public class KuaiShouDimensionAccount {
+
+    /**
+     * id
+     */
+    @TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "id")
+    private Long id;
+    /**
+     * 策略id
+     */
+    @Excel(name = "策略id", width = 15)
+    @ApiModelProperty(value = "策略id")
+    private Long strategyId;
+    /**
+     * 账户id
+     */
+    @Excel(name = "账户id", width = 15)
+    @ApiModelProperty(value = "账户id")
+    private Long accountId;
+    /**
+     * 账户状态状态
+     */
+    @Excel(name = "账户状态状态", width = 15)
+    @ApiModelProperty(value = "账户状态状态")
+    private Integer accountStatus;
+    /**
+     * 应用id
+     */
+    @Excel(name = "应用id", width = 15)
+    @ApiModelProperty(value = "应用id")
+    private Long appId;
+    /**
+     * 第三方点击检测链接
+     */
+    @Excel(name = "第三方点击检测链接", width = 15)
+    @ApiModelProperty(value = "第三方点击检测链接")
+    private String clickTrackUrl;
+    /**
+     * 第三方点击按钮监测链接
+     */
+    @Excel(name = "第三方点击按钮监测链接", width = 15)
+    @ApiModelProperty(value = "第三方点击按钮监测链接")
+    private String actionbarClickUrl;
+    /**
+     * 创意分类
+     */
+    @Excel(name = "创意分类", width = 15)
+    @ApiModelProperty(value = "创意分类")
+    private Integer creativeCategory;
+    /**
+     * 创意标签
+     */
+    @Excel(name = "创意标签", width = 15)
+    @ApiModelProperty(value = "创意标签")
+    private String creativeTag;
+
+
+    private String population;
+    private String excludePopulation;
+    private String paidAudience;
+
+    private Integer useSchemaUri;
+    private String schemaUri;
+
+}

+ 63 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/entity/KuaiShouDimensionAgeConfig.java

@@ -0,0 +1,63 @@
+package cn.com.ctop.kuaishou.modules.dimension.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-07-29
+ */
+@Data
+@TableName("ctop_kuaishou_dimension_age_config")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_kuaishou_dimension_age_config对象", description = "素材多维度年龄配置")
+public class KuaiShouDimensionAgeConfig {
+
+    /**
+     * id
+     */
+    @TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "id")
+    private Long id;
+    /**
+     * 年龄组id
+     */
+    @Excel(name = "年龄组id", width = 15)
+    @ApiModelProperty(value = "年龄组id")
+    private String ageGroupId;
+    /**
+     * 年龄组名称
+     */
+    @Excel(name = "年龄组名称", width = 15)
+    @ApiModelProperty(value = "年龄组名称")
+    private String ageGroupName;
+    /**
+     * ageGroupValue
+     */
+    @Excel(name = "ageGroupValue", width = 15)
+    @ApiModelProperty(value = "ageGroupValue")
+    private String ageGroupValue;
+    /**
+     * createTime
+     */
+    @ApiModelProperty(value = "createTime")
+    private Date createTime;
+    /**
+     * updateTime
+     */
+    @ApiModelProperty(value = "updateTime")
+    private Date updateTime;
+}

+ 81 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/entity/KuaiShouDimensionCampaign.java

@@ -0,0 +1,81 @@
+package cn.com.ctop.kuaishou.modules.dimension.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-07-24
+ */
+@Data
+@TableName("ctop_kuaishou_dimension_campaign")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_kuaishou_dimension_campaign对象", description = "素材多维度测试计划信息")
+public class KuaiShouDimensionCampaign {
+
+    /**
+     * id
+     */
+    @TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "id")
+    private Long id;
+    /**
+     * 策略id
+     */
+    @Excel(name = "策略id", width = 15)
+    @ApiModelProperty(value = "策略id")
+    private Long strategyId;
+    /**
+     * 账户id
+     */
+    @Excel(name = "账户id", width = 15)
+    @ApiModelProperty(value = "账户id")
+    private Long accountId;
+    /**
+     * 计划id
+     */
+    @Excel(name = "计划id", width = 15)
+    @ApiModelProperty(value = "计划id")
+    private Long campaignId;
+    /**
+     * 计划类型
+     */
+    @Excel(name = "计划类型", width = 15)
+    @ApiModelProperty(value = "计划类型")
+    private Integer campaignType;
+    /**
+     * 计划名称
+     */
+    @Excel(name = "计划名称", width = 15)
+    @ApiModelProperty(value = "计划名称")
+    private String campaignName;
+    /**
+     * 计划预算
+     */
+    @Excel(name = "计划预算", width = 15)
+    @ApiModelProperty(value = "计划预算")
+    private Long dayBudget;
+    /**
+     * createTime
+     */
+    @ApiModelProperty(value = "createTime")
+    private Date createTime;
+    /**
+     * updateTime
+     */
+    @ApiModelProperty(value = "updateTime")
+    private Date updateTime;
+}

+ 131 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/entity/KuaiShouDimensionCreative.java

@@ -0,0 +1,131 @@
+package cn.com.ctop.kuaishou.modules.dimension.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-07-22
+ */
+@Data
+@TableName("ctop_kuaishou_dimension_creative")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_kuaishou_dimension_creative对象", description = "多维度测试关联创意")
+public class KuaiShouDimensionCreative {
+
+    /**
+     * id
+     */
+    @TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "id")
+    private Long id;
+
+    private Long strategyId;
+
+    /**
+     * 账户id
+     */
+    @Excel(name = "账户id", width = 15)
+    @ApiModelProperty(value = "账户id")
+    private Long accountId;
+    /**
+     * 计划id
+     */
+    @Excel(name = "计划id", width = 15)
+    @ApiModelProperty(value = "计划id")
+    private Long campaignId;
+    private Long unitId;
+    private Long creativeId;
+    /**
+     * 组id
+     */
+    @Excel(name = "组id", width = 15)
+    @ApiModelProperty(value = "组id")
+    private String unitTableId;
+    /**
+     * 创意名称
+     */
+    @Excel(name = "创意名称", width = 15)
+    @ApiModelProperty(value = "创意名称")
+    private String creativeName;
+    /**
+     * 视频id
+     */
+    @Excel(name = "视频id", width = 15)
+    @ApiModelProperty(value = "视频id")
+    private Long photoId;
+    /**
+     * 素材类型
+     */
+    @Excel(name = "素材类型", width = 15)
+    @ApiModelProperty(value = "素材类型")
+    private Integer creativeMaterialType;
+    /**
+     * 行动号召按钮
+     */
+    @Excel(name = "行动号召按钮", width = 15)
+    @ApiModelProperty(value = "行动号召按钮")
+    private String actionBarText;
+    /**
+     * 广告语
+     */
+    @Excel(name = "广告语", width = 15)
+    @ApiModelProperty(value = "广告语")
+    private String description;
+    /**
+     * 第三方点击检测链接
+     */
+    @Excel(name = "第三方点击检测链接", width = 15)
+    @ApiModelProperty(value = "第三方点击检测链接")
+    private String clickTrackUrl;
+    /**
+     * 第三方点击按钮监测链接
+     */
+    @Excel(name = "第三方点击按钮监测链接", width = 15)
+    @ApiModelProperty(value = "第三方点击按钮监测链接")
+    private String actionbarClickUrl;
+    /**
+     * 创意分类
+     */
+    @Excel(name = "创意分类", width = 15)
+    @ApiModelProperty(value = "创意分类")
+    private Integer creativeCategory;
+    /**
+     * 创意标签
+     */
+    @Excel(name = "创意标签", width = 15)
+    @ApiModelProperty(value = "创意标签")
+    private String creativeTag;
+    private Integer createStatus;
+    private String createDescribe;
+    @TableField(exist = false)
+    private String PhotoUrl;
+
+    @TableField(exist = false)
+    private String coverUrl;
+
+    /**
+     * createTime
+     */
+    @ApiModelProperty(value = "createTime")
+    private Date createTime;
+    /**
+     * updateTime
+     */
+    @ApiModelProperty(value = "updateTime")
+    private Date updateTime;
+}

+ 63 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/entity/KuaiShouDimensionMaterial.java

@@ -0,0 +1,63 @@
+package cn.com.ctop.kuaishou.modules.dimension.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-07-23
+ */
+@Data
+@TableName("ctop_kuaishou_dimension_material")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_kuaishou_dimension_material对象", description = "多维度测试素材列表")
+public class KuaiShouDimensionMaterial {
+
+    /**
+     * id
+     */
+    @TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "id")
+    private Long id;
+    /**
+     * 策略id
+     */
+    @Excel(name = "策略id", width = 15)
+    @ApiModelProperty(value = "策略id")
+    private Long strategyId;
+    /**
+     * 视频id
+     */
+    @Excel(name = "视频id", width = 15)
+    @ApiModelProperty(value = "视频id")
+    private Long photoId;
+    /**
+     * MD5值
+     */
+  /*  @Excel(name = "MD5值", width = 15)
+    @ApiModelProperty(value = "MD5值")
+    private String signature;*/
+    /**
+     * updateTime
+     */
+    @ApiModelProperty(value = "updateTime")
+    private Date updateTime;
+    /**
+     * createTime
+     */
+    @ApiModelProperty(value = "createTime")
+    private Date createTime;
+}

+ 57 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/entity/KuaiShouDimensionRegionConfig.java

@@ -0,0 +1,57 @@
+package cn.com.ctop.kuaishou.modules.dimension.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-07-21
+ */
+@Data
+@TableName("ctop_kuaishou_dimension_region_config")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_kuaishou_dimension_region_config对象", description = "地域配置")
+public class KuaiShouDimensionRegionConfig {
+
+    /**
+     * id
+     */
+    @TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "id")
+    private Long id;
+    /**
+     * 地域组id
+     */
+    @Excel(name = "地域组id", width = 15)
+    @ApiModelProperty(value = "地域组id")
+    private String regionGroupId;
+    /**
+     * 地域组名称
+     */
+    @Excel(name = "地域组名称", width = 15)
+    @ApiModelProperty(value = "地域组名称")
+    private String regionGroupName;
+    /**
+     * createTime
+     */
+    @ApiModelProperty(value = "createTime")
+    private Date createTime;
+    /**
+     * updateTime
+     */
+    @ApiModelProperty(value = "updateTime")
+    private Date updateTime;
+}

+ 63 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/entity/KuaiShouDimensionRegionDetail.java

@@ -0,0 +1,63 @@
+package cn.com.ctop.kuaishou.modules.dimension.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-07-21
+ */
+@Data
+@TableName("ctop_kuaishou_dimension_region_detail")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_kuaishou_dimension_region_detail对象", description = "地域")
+public class KuaiShouDimensionRegionDetail {
+
+    /**
+     * id
+     */
+    @TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "id")
+    private Long id;
+    /**
+     * 地域组id
+     */
+    @Excel(name = "地域组id", width = 15)
+    @ApiModelProperty(value = "地域组id")
+    private String regionGroupId;
+    /**
+     * 快手地域id
+     */
+    @Excel(name = "快手地域id", width = 15)
+    @ApiModelProperty(value = "快手地域id")
+    private Long regionId;
+    /**
+     * 快手地域名称
+     */
+    @Excel(name = "快手地域名称", width = 15)
+    @ApiModelProperty(value = "快手地域名称")
+    private String regionName;
+    /**
+     * createTime
+     */
+    @ApiModelProperty(value = "createTime")
+    private Date createTime;
+    /**
+     * updateTime
+     */
+    @ApiModelProperty(value = "updateTime")
+    private Date updateTime;
+}

+ 201 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/entity/KuaiShouDimensionStrategy.java

@@ -0,0 +1,201 @@
+package cn.com.ctop.kuaishou.modules.dimension.entity;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+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-07-19
+ */
+@Data
+@TableName("ctop_kuaishou_dimension_strategy")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_kuaishou_dimension_strategy对象", description = "多维度测试策略表")
+public class KuaiShouDimensionStrategy {
+
+    /**
+     * id
+     */
+    @TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "id")
+    private Long id;
+    /**
+     * 策略状态
+     */
+    @Excel(name = "策略状态", width = 15)
+    @ApiModelProperty(value = "策略状态")
+    private Integer strategyStatus;
+    /**
+     * 计划类型
+     */
+    @Excel(name = "计划类型", width = 15)
+    @ApiModelProperty(value = "计划类型")
+    private Integer campaignType;
+    /**
+     * 计划命名
+     */
+    @Excel(name = "计划命名", width = 15)
+    @ApiModelProperty(value = "计划命名")
+    private String campaignName;
+    /**
+     * 计划预算
+     */
+    @Excel(name = "计划预算", width = 15)
+    @ApiModelProperty(value = "计划预算")
+    private Long campaignDayBudget;
+    /**
+     * 组命名
+     */
+    @Excel(name = "组命名", width = 15)
+    @ApiModelProperty(value = "组命名")
+    private String unitName;
+    /**
+     * 组预算
+     */
+    @Excel(name = "组预算", width = 15)
+    @ApiModelProperty(value = "组预算")
+    private Long unitDayBudget;
+
+    private Integer useAppMarket;
+    private String appStore;
+    private Integer unitType;
+    private Integer showMode;
+    private Integer speed;
+
+    /**
+     * 网络环境 1:Wi-Fi,2:移动网络,0:表示不限
+     */
+    @Excel(name = "网络环境 1:Wi-Fi,2:移动网络,0:表示不限", width = 15)
+    @ApiModelProperty(value = "网络环境 1:Wi-Fi,2:移动网络,0:表示不限")
+    private Integer network;
+    /**
+     * 网红粉丝
+     */
+    @Excel(name = "网红粉丝", width = 15)
+    @ApiModelProperty(value = "网红粉丝")
+    private String fansStar;
+    /**
+     * 过滤已转化人群纬度 0(默认):不限;1:广告组2:广告计划;3:本账户;4:公司主体;5:APP
+     */
+    @Excel(name = "过滤已转化人群纬度 0(默认):不限;1:广告组2:广告计划;3:本账户;4:公司主体;5:APP", width = 15)
+    @ApiModelProperty(value = "过滤已转化人群纬度 0(默认):不限;1:广告组2:广告计划;3:本账户;4:公司主体;5:APP")
+    private Integer filterConvertedLevel;
+    /**
+     * 设备品牌 1:OPPO,2:VIVO,3:华为,4:小米,5:荣耀,6:三星,7:金立,8:魅族,9:乐视10:其他,11:苹果
+     */
+    @Excel(name = "设备品牌 1:OPPO,2:VIVO,3:华为,4:小米,5:荣耀,6:三星,7:金立,8:魅族,9:乐视10:其他,11:苹果", width = 15)
+    @ApiModelProperty(value = "设备品牌 1:OPPO,2:VIVO,3:华为,4:小米,5:荣耀,6:三星,7:金立,8:魅族,9:乐视10:其他,11:苹果")
+    private String deviceBrand;
+    /**
+     * 设备价格 1:1500元以下,2:1501~2000,3:2001~2500,4:2501~3000,5:3001~3500,6:3501~4000,7:4001~4500,8:4501~5000,9: 5001~5500,10:5500元以上
+     */
+    @Excel(name = "设备价格 1:1500元以下,2:1501~2000,3:2001~2500,4:2501~3000,5:3001~3500,6:3501~4000,7:4001~4500,8:4501~5000,9: 5001~5500,10:5500元以上", width = 15)
+    @ApiModelProperty(value = "设备价格 1:1500元以下,2:1501~2000,3:2001~2500,4:2501~3000,5:3001~3500,6:3501~4000,7:4001~4500,8:4501~5000,9: 5001~5500,10:5500元以上")
+    private String devicePrice;
+
+    /**
+     * 优化目标出价类型  1: CPM 2: CPC 10:OCPM
+     */
+    @Excel(name = "优化目标出价类型  1: CPM 2: CPC 10:OCPM", width = 15)
+    @ApiModelProperty(value = "优化目标出价类型  1: CPM 2: CPC 10:OCPM")
+    private Integer bidType;
+    /**
+     * 转化目标
+     */
+    @Excel(name = "转化目标", width = 15)
+    @ApiModelProperty(value = "转化目标")
+    private Integer ocpxActionType;
+    /**
+     * 深度转化目标
+     */
+    @Excel(name = "深度转化目标", width = 15)
+    @ApiModelProperty(value = "深度转化目标")
+    private Integer deepConversionType;
+    /**
+     * 出价
+     */
+    @Excel(name = "出价", width = 15)
+    @ApiModelProperty(value = "出价")
+    private Long bid;
+    /**
+     * ocpm出价
+     */
+    @Excel(name = "ocpm出价", width = 15)
+    @ApiModelProperty(value = "ocpm出价")
+    private String cpaBid;
+    /**
+     * 深度转化目标出价
+     */
+    @Excel(name = "深度转化目标出价", width = 15)
+    @ApiModelProperty(value = "深度转化目标出价")
+    private Long deepConversionBid;
+    /**
+     * 资源位置
+     */
+    @Excel(name = "资源位置", width = 15)
+    @ApiModelProperty(value = "资源位置")
+    private String sceneId;
+    /**
+     * 行动号召按钮
+     */
+    @Excel(name = "行动号召按钮", width = 15)
+    @ApiModelProperty(value = "行动号召按钮")
+    private String actionBarText;
+    /**
+     * 广告语
+     */
+    @Excel(name = "广告语", width = 15)
+    @ApiModelProperty(value = "广告语")
+    private String description;
+
+    private Integer unitNum;
+    private Integer materialNum;
+    /**
+     * createTime
+     */
+    @ApiModelProperty(value = "createTime")
+    private Date createTime;
+    /**
+     * updateTime
+     */
+    @ApiModelProperty(value = "updateTime")
+    private Date updateTime;
+    /**
+     * 策略名称
+     */
+    @Excel(name = "策略名称", width = 15)
+    @ApiModelProperty(value = "策略名称")
+    private String strategyName;
+    private String userId;
+
+    @TableField(exist = false)
+    private JSONArray appInfoArray;
+    @TableField(exist = false)
+    private JSONArray creativeArray;
+    @TableField(exist = false)
+    private JSONArray crowdArray;
+    @TableField(exist = false)
+    private JSONObject reportData;
+    @TableField(exist = false)
+    private String startDate;
+    @TableField(exist = false)
+    private String endDate;
+
+
+}

+ 277 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/entity/KuaiShouDimensionUnit.java

@@ -0,0 +1,277 @@
+package cn.com.ctop.kuaishou.modules.dimension.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-07-22
+ */
+@Data
+@TableName("ctop_kuaishou_dimension_unit")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_kuaishou_dimension_unit对象", description = " 多维度测试组列表")
+public class KuaiShouDimensionUnit {
+
+    /**
+     * id
+     */
+    @TableId(type = IdType.UUID)
+    @ApiModelProperty(value = "id")
+    private String id;
+    /**
+     * 账户id
+     */
+    @Excel(name = "账户id", width = 15)
+    @ApiModelProperty(value = "账户id")
+    private Long accountId;
+    private Long strategyId;
+    /**
+     * 计划id
+     */
+    @Excel(name = "计划id", width = 15)
+    @ApiModelProperty(value = "计划id")
+    private Long campaignId;
+    /**
+     * 组id
+     */
+    @Excel(name = "组id", width = 15)
+    @ApiModelProperty(value = "组id")
+    private Long unitId;
+    /**
+     * 组名称
+     */
+    @Excel(name = "组名称", width = 15)
+    @ApiModelProperty(value = "组名称")
+    private String unitName;
+    /**
+     * 组预算
+     */
+    @Excel(name = "组预算", width = 15)
+    @ApiModelProperty(value = "组预算")
+    private Long unitDayBudget;
+    /**
+     * 优先从系统应用商店下载
+     */
+    @Excel(name = "优先从系统应用商店下载", width = 15)
+    @ApiModelProperty(value = "优先从系统应用商店下载")
+    private Integer useAppMarket;
+    /**
+     * 应用商店列表
+     */
+    @Excel(name = "应用商店列表", width = 15)
+    @ApiModelProperty(value = "应用商店列表")
+    private String appStore;
+    /**
+     * 应用id
+     */
+    @Excel(name = "应用id", width = 15)
+    @ApiModelProperty(value = "应用id")
+    private Long appId;
+    /**
+     * 吊起链接
+     */
+    @Excel(name = "吊起链接", width = 15)
+    @ApiModelProperty(value = "吊起链接")
+    private String schemaUri;
+    /**
+     * 创意展现方式	1 - 轮播;2 - 优选
+     */
+    @Excel(name = "创意展现方式	1 - 轮播;2 - 优选", width = 15)
+    @ApiModelProperty(value = "创意展现方式	1 - 轮播;2 - 优选")
+    private Integer showMode;
+    /**
+     * 投放方式	1 - 加速投放;2 - 平滑投放;3-优先低成本(投放时间范围只可为全天;预算不可为不限或空
+     */
+    @Excel(name = "投放方式	1 - 加速投放;2 - 平滑投放;3-优先低成本(投放时间范围只可为全天;预算不可为不限或空", width = 15)
+    @ApiModelProperty(value = "投放方式	1 - 加速投放;2 - 平滑投放;3-优先低成本(投放时间范围只可为全天;预算不可为不限或空")
+    private Integer speed;
+    /**
+     * 人群包定向
+     */
+    @Excel(name = "人群包定向", width = 15)
+    @ApiModelProperty(value = "人群包定向")
+    private String population;
+    /**
+     * 人群包排除
+     */
+    @Excel(name = "人群包排除", width = 15)
+    @ApiModelProperty(value = "人群包排除")
+    private String excludePopulation;
+    /**
+     * 付费人群包
+     */
+    @Excel(name = "付费人群包", width = 15)
+    @ApiModelProperty(value = "付费人群包")
+    private String paidAudience;
+    /**
+     * 网络环境 1:Wi-Fi,2:移动网络,0:表示不限
+     */
+    @Excel(name = "网络环境 1:Wi-Fi,2:移动网络,0:表示不限", width = 15)
+    @ApiModelProperty(value = "网络环境 1:Wi-Fi,2:移动网络,0:表示不限")
+    private Integer network;
+    /**
+     * 网红粉丝
+     */
+    @Excel(name = "网红粉丝", width = 15)
+    @ApiModelProperty(value = "网红粉丝")
+    private String fansStar;
+    /**
+     * 过滤已转化人群纬度 0(默认):不限;1:广告组2:广告计划;3:本账户;4:公司主体;5:APP
+     */
+    @Excel(name = "过滤已转化人群纬度 0(默认):不限;1:广告组2:广告计划;3:本账户;4:公司主体;5:APP", width = 15)
+    @ApiModelProperty(value = "过滤已转化人群纬度 0(默认):不限;1:广告组2:广告计划;3:本账户;4:公司主体;5:APP")
+    private Integer filterConvertedLevel;
+    /**
+     * 设备品牌 1:OPPO,2:VIVO,3:华为,4:小米,5:荣耀,6:三星,7:金立,8:魅族,9:乐视10:其他,11:苹果
+     */
+    @Excel(name = "设备品牌 1:OPPO,2:VIVO,3:华为,4:小米,5:荣耀,6:三星,7:金立,8:魅族,9:乐视10:其他,11:苹果", width = 15)
+    @ApiModelProperty(value = "设备品牌 1:OPPO,2:VIVO,3:华为,4:小米,5:荣耀,6:三星,7:金立,8:魅族,9:乐视10:其他,11:苹果")
+    private String deviceBrand;
+    /**
+     * 设备价格 1:1500元以下,2:1501~2000,3:2001~2500,4:2501~3000,5:3001~3500,6:3501~4000,7:4001~4500,8:4501~5000,9: 5001~5500,10:5500元以上
+     */
+    @Excel(name = "设备价格 1:1500元以下,2:1501~2000,3:2001~2500,4:2501~3000,5:3001~3500,6:3501~4000,7:4001~4500,8:4501~5000,9: 5001~5500,10:5500元以上", width = 15)
+    @ApiModelProperty(value = "设备价格 1:1500元以下,2:1501~2000,3:2001~2500,4:2501~3000,5:3001~3500,6:3501~4000,7:4001~4500,8:4501~5000,9: 5001~5500,10:5500元以上")
+    private String devicePrice;
+    /**
+     * 优化目标出价类型  1: CPM 2: CPC 10:OCPM
+     */
+    @Excel(name = "优化目标出价类型  1: CPM 2: CPC 10:OCPM", width = 15)
+    @ApiModelProperty(value = "优化目标出价类型  1: CPM 2: CPC 10:OCPM")
+    private Integer bidType;
+    /**
+     * 创意制作方式 4: 自定义;5:程序化创意 7:程序化创意2.0
+     */
+    @Excel(name = "创意制作方式 4: 自定义;5:程序化创意 7:程序化创意2.0", width = 15)
+    @ApiModelProperty(value = "创意制作方式 4: 自定义;5:程序化创意 7:程序化创意2.0")
+    private Integer unitType;
+    /**
+     * 转化目标
+     */
+    @Excel(name = "转化目标", width = 15)
+    @ApiModelProperty(value = "转化目标")
+    private Integer ocpxActionType;
+    /**
+     * 深度转化目标
+     */
+    @Excel(name = "深度转化目标", width = 15)
+    @ApiModelProperty(value = "深度转化目标")
+    private Integer deepConversionType;
+    /**
+     * 出价
+     */
+    @Excel(name = "出价", width = 15)
+    @ApiModelProperty(value = "出价")
+    private Long bid;
+    /**
+     * ocpm出价
+     */
+    @Excel(name = "ocpm出价", width = 15)
+    @ApiModelProperty(value = "ocpm出价")
+    private Long cpaBid;
+    /**
+     * 深度转化目标出价
+     */
+    @Excel(name = "深度转化目标出价", width = 15)
+    @ApiModelProperty(value = "深度转化目标出价")
+    private Long deepConversionBid;
+    /**
+     * 资源位置
+     */
+    @Excel(name = "资源位置", width = 15)
+    @ApiModelProperty(value = "资源位置")
+    private String sceneId;
+    /**
+     * 变量 地域
+     */
+    @Excel(name = "变量 地域", width = 15)
+    @ApiModelProperty(value = "变量 地域")
+    private String region;
+    private String regionGroupName;
+    /**
+     * 变量 年龄 【18:表示18-23岁】;【24:表示24-30岁】;【31:表示31-40岁】;【41:表示41-49岁】;【50:表示50-100岁】
+     */
+    @Excel(name = "变量 年龄 【18:表示18-23岁】;【24:表示24-30岁】;【31:表示31-40岁】;【41:表示41-49岁】;【50:表示50-100岁】", width = 15)
+    @ApiModelProperty(value = "变量 年龄 【18:表示18-23岁】;【24:表示24-30岁】;【31:表示31-40岁】;【41:表示41-49岁】;【50:表示50-100岁】")
+    private String agesRange;
+    private String ageGroupName;
+    /**
+     * 变量 性别 1:女性, 2:男性,0表示不限
+     */
+    @Excel(name = "变量 性别 1:女性, 2:男性,0表示不限", width = 15)
+    @ApiModelProperty(value = "变量 性别 1:女性, 2:男性,0表示不限")
+    private Integer gender;
+    /**
+     * 变量 行为意向-系统优选	 1:女性, 2:男性,0表示不限
+     */
+    @Excel(name = "变量 行为意向-系统优选	 1:女性, 2:男性,0表示不限", width = 15)
+    @ApiModelProperty(value = "变量 行为意向-系统优选	 1:女性, 2:男性,0表示不限")
+    private Boolean intentionTarget;
+    /**
+     * 变量 APP行为-按APP名称
+     */
+    @Excel(name = "变量 APP行为-按APP名称", width = 15)
+    @ApiModelProperty(value = "变量 APP行为-按APP名称")
+    private String appIds;
+    /**
+     * 变量 投放时段
+     */
+    @Excel(name = "变量 投放时段", width = 15)
+    @ApiModelProperty(value = "变量 投放时段")
+    private String scheduleTime;
+    /**
+     * 0:关闭智能扩量,1:打开智能扩量
+     */
+    @Excel(name = "0:关闭智能扩量,1:打开智能扩量", width = 15)
+    @ApiModelProperty(value = "0:关闭智能扩量,1:打开智能扩量")
+    private Integer isOpen;
+    /**
+     * 0:可突破/无需控制,1:不可突破
+     */
+    @Excel(name = "0:可突破/无需控制,1:不可突破", width = 15)
+    @ApiModelProperty(value = "0:可突破/无需控制,1:不可突破")
+    private Integer noAgeBreak;
+    /**
+     * 0:可突破/无需控制,1:不可突破
+     */
+    @Excel(name = "0:可突破/无需控制,1:不可突破", width = 15)
+    @ApiModelProperty(value = "0:可突破/无需控制,1:不可突破")
+    private Integer noGenderBreak;
+    /**
+     * 0:可突破/无需控制,1:不可突破
+     */
+    @Excel(name = "0:可突破/无需控制,1:不可突破", width = 15)
+    @ApiModelProperty(value = "0:可突破/无需控制,1:不可突破")
+    private Integer noAreaBreak;
+    /**
+     * 状态 0 未提交 1 已提交 2 创建成功 3 创建失败 4 待重新创建
+     */
+    @Excel(name = "状态 0 未提交 1 已提交 2 创建成功 3 创建失败 4 待重新创建", width = 15)
+    @ApiModelProperty(value = "状态 0 未提交 1 已提交 2 创建成功 3 创建失败 4 待重新创建")
+    private Integer submitStatus;
+    private String createDescribe;
+    /**
+     * createTime
+     */
+    @ApiModelProperty(value = "createTime")
+    private Date createTime;
+    /**
+     * updateTime
+     */
+    @ApiModelProperty(value = "updateTime")
+    private Date updateTime;
+}

+ 93 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/entity/KuaiShouDimensionVariable.java

@@ -0,0 +1,93 @@
+package cn.com.ctop.kuaishou.modules.dimension.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-07-20
+ */
+@Data
+@TableName("ctop_kuaishou_dimension_variable")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_kuaishou_dimension_variable对象", description = "多维度测试变量配置")
+public class KuaiShouDimensionVariable {
+
+    /**
+     * id
+     */
+    @TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "id")
+    private Long id;
+    /**
+     * 策略id
+     */
+    @Excel(name = "策略id", width = 15)
+    @ApiModelProperty(value = "策略id")
+    private Long strategyId;
+    /**
+     * 变量 地域
+     */
+    @Excel(name = "变量 地域", width = 15)
+    @ApiModelProperty(value = "变量 地域")
+    private String region;
+    /**
+     * 变量 年龄 【18:表示18-23岁】;【24:表示24-30岁】;【31:表示31-40岁】;【41:表示41-49岁】;【50:表示50-100岁】
+     */
+    @Excel(name = "变量 年龄 【18:表示18-23岁】;【24:表示24-30岁】;【31:表示31-40岁】;【41:表示41-49岁】;【50:表示50-100岁】", width = 15)
+    @ApiModelProperty(value = "变量 年龄 【18:表示18-23岁】;【24:表示24-30岁】;【31:表示31-40岁】;【41:表示41-49岁】;【50:表示50-100岁】")
+    private String agesRange;
+    /**
+     * 变量 性别 1:女性, 2:男性,0表示不限
+     */
+    @Excel(name = "变量 性别 1:女性, 2:男性,0表示不限", width = 15)
+    @ApiModelProperty(value = "变量 性别 1:女性, 2:男性,0表示不限")
+    private String gender;
+    /**
+     * 变量 行为意向-系统优选	 1:女性, 2:男性,0表示不限
+     */
+    @Excel(name = "变量 行为意向-系统优选	 1:女性, 2:男性,0表示不限", width = 15)
+    @ApiModelProperty(value = "变量 行为意向-系统优选	 1:女性, 2:男性,0表示不限")
+    private String intentionTarget;
+    /**
+     * 变量 APP行为-按APP名称
+     */
+    @Excel(name = "变量 APP行为-按APP名称", width = 15)
+    @ApiModelProperty(value = "变量 APP行为-按APP名称")
+    private String appIds;
+    /**
+     * 变量 0:关闭 1:开启 2:不可突破年龄 3:不可突破性别	 4:不可突破地域
+     */
+    @Excel(name = "变量 0:关闭 1:开启 2:不可突破年龄 3:不可突破性别	 4:不可突破地域", width = 15)
+    @ApiModelProperty(value = "变量 0:关闭 1:开启 2:不可突破年龄 3:不可突破性别	 4:不可突破地域")
+    private String intelliExtend;
+    /**
+     * 变量 投放时段
+     */
+    @Excel(name = "变量 投放时段", width = 15)
+    @ApiModelProperty(value = "变量 投放时段")
+    private String scheduleTime;
+    /**
+     * createTime
+     */
+    @ApiModelProperty(value = "createTime")
+    private Date createTime;
+    /**
+     * updateTime
+     */
+    @ApiModelProperty(value = "updateTime")
+    private Date updateTime;
+}

+ 19 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/mapper/KuaiShouDimensionAccountMapper.java

@@ -0,0 +1,19 @@
+package cn.com.ctop.kuaishou.modules.dimension.mapper;
+
+import cn.com.ctop.kuaishou.modules.dimension.entity.KuaiShouDimensionAccount;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 多维度测试关联账户表
+ *
+ * @author jeecg-boot
+ * 2021-07-19
+ * @version V1.0
+ */
+public interface KuaiShouDimensionAccountMapper extends BaseMapper<KuaiShouDimensionAccount> {
+
+    void addBatch(@Param("addList") List<KuaiShouDimensionAccount> addList);
+}

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

@@ -0,0 +1,15 @@
+package cn.com.ctop.kuaishou.modules.dimension.mapper;
+
+import cn.com.ctop.kuaishou.modules.dimension.entity.KuaiShouDimensionAgeConfig;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 素材多维度年龄配置
+ *
+ * @author jeecg-boot
+ * 2021-07-29
+ * @version V1.0
+ */
+public interface KuaiShouDimensionAgeConfigMapper extends BaseMapper<KuaiShouDimensionAgeConfig> {
+
+}

+ 17 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/mapper/KuaiShouDimensionCampaignMapper.java

@@ -0,0 +1,17 @@
+package cn.com.ctop.kuaishou.modules.dimension.mapper;
+
+import cn.com.ctop.kuaishou.modules.dimension.entity.KuaiShouDimensionCampaign;
+import com.alibaba.fastjson.JSONArray;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * 素材多维度测试计划信息
+ *
+ * @author jeecg-boot
+ * 2021-07-24
+ * @version V1.0
+ */
+public interface KuaiShouDimensionCampaignMapper extends BaseMapper<KuaiShouDimensionCampaign> {
+
+}

+ 26 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/mapper/KuaiShouDimensionCreativeMapper.java

@@ -0,0 +1,26 @@
+package cn.com.ctop.kuaishou.modules.dimension.mapper;
+
+import cn.com.ctop.kuaishou.modules.dimension.entity.KuaiShouDimensionCreative;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.web.bind.annotation.PostMapping;
+
+import java.util.List;
+
+/**
+ * 多维度测试关联创意
+ *
+ * @author jeecg-boot
+ * 2021-07-22
+ * @version V1.0
+ */
+public interface KuaiShouDimensionCreativeMapper extends BaseMapper<KuaiShouDimensionCreative> {
+
+    void addBatch(@Param("addList") List<KuaiShouDimensionCreative> addList);
+
+    void updateBy(@Param("unitTableId") String id);
+
+    List<Long> getAccountList();
+
+    void removeByUnitTableIds(@Param("ids") List<String> strings);
+}

+ 25 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/mapper/KuaiShouDimensionMaterialMapper.java

@@ -0,0 +1,25 @@
+package cn.com.ctop.kuaishou.modules.dimension.mapper;
+
+import cn.com.ctop.kuaishou.modules.dimension.entity.KuaiShouDimensionMaterial;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 多维度测试素材列表
+ *
+ * @author jeecg-boot
+ * 2021-07-23
+ * @version V1.0
+ */
+public interface KuaiShouDimensionMaterialMapper extends BaseMapper<KuaiShouDimensionMaterial> {
+
+    void addBatch(@Param("addList") List<KuaiShouDimensionMaterial> dimensionMaterials);
+
+    List<JSONObject> getVideoList(Map<String, Object> requestMap);
+
+    String getSignatureByPhotoId(@Param("photoId") Long photoId);
+}

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

@@ -0,0 +1,15 @@
+package cn.com.ctop.kuaishou.modules.dimension.mapper;
+
+import cn.com.ctop.kuaishou.modules.dimension.entity.KuaiShouDimensionRegionConfig;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 地域配置
+ *
+ * @author jeecg-boot
+ * 2021-07-21
+ * @version V1.0
+ */
+public interface KuaiShouDimensionRegionConfigMapper extends BaseMapper<KuaiShouDimensionRegionConfig> {
+
+}

+ 19 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/mapper/KuaiShouDimensionRegionDetailMapper.java

@@ -0,0 +1,19 @@
+package cn.com.ctop.kuaishou.modules.dimension.mapper;
+
+import cn.com.ctop.kuaishou.modules.dimension.entity.KuaiShouDimensionRegionDetail;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 地域
+ *
+ * @author jeecg-boot
+ * 2021-07-21
+ * @version V1.0
+ */
+public interface KuaiShouDimensionRegionDetailMapper extends BaseMapper<KuaiShouDimensionRegionDetail> {
+
+    List<Long> getRegionList(@Param("regionGroupId") String regionGroupId);
+}

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

@@ -0,0 +1,15 @@
+package cn.com.ctop.kuaishou.modules.dimension.mapper;
+
+import cn.com.ctop.kuaishou.modules.dimension.entity.KuaiShouDimensionStrategy;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 多维度测试策略表
+ *
+ * @author jeecg-boot
+ * 2021-07-19
+ * @version V1.0
+ */
+public interface KuaiShouDimensionStrategyMapper extends BaseMapper<KuaiShouDimensionStrategy> {
+
+}

+ 27 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/mapper/KuaiShouDimensionUnitMapper.java

@@ -0,0 +1,27 @@
+package cn.com.ctop.kuaishou.modules.dimension.mapper;
+
+import cn.com.ctop.kuaishou.modules.dimension.entity.KuaiShouDimensionUnit;
+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-07-22
+ * @version V1.0
+ */
+public interface KuaiShouDimensionUnitMapper extends BaseMapper<KuaiShouDimensionUnit> {
+
+    List<JSONObject> getCampaignCount(@Param("accountId") Long accountId, @Param("strategyId") Long strategyId);
+
+    Integer getUnitCount(@Param("accountId") Long accountId, @Param("strategyId") Long strategyId);
+
+    void editBatch(@Param("submitStatus") Integer submitStatus, @Param("ids") JSONArray ids);
+
+    Integer getUnitCountByStrategyId(@Param("strategyId") Long strategyId);
+}

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

@@ -0,0 +1,15 @@
+package cn.com.ctop.kuaishou.modules.dimension.mapper;
+
+import cn.com.ctop.kuaishou.modules.dimension.entity.KuaiShouDimensionVariable;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 多维度测试变量配置
+ *
+ * @author jeecg-boot
+ * 2021-07-20
+ * @version V1.0
+ */
+public interface KuaiShouDimensionVariableMapper extends BaseMapper<KuaiShouDimensionVariable> {
+
+}

+ 44 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/mapper/xml/KuaiShouDimensionAccountMapper.xml

@@ -0,0 +1,44 @@
+<?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.dimension.mapper.KuaiShouDimensionAccountMapper">
+
+    <insert id="addBatch">
+        insert into ctop_kuaishou_dimension_account(
+        id,
+        strategy_id,
+        account_id,
+        account_status,
+        app_id,
+        click_track_url,
+        actionbar_click_url,
+        creative_category,
+        creative_tag,
+        use_schema_uri,
+        schema_uri,
+        population,
+        exclude_population,
+        paid_audience
+
+        )
+        values
+        <foreach collection="addList" item="ad" separator=",">
+            (
+            #{ad.id},
+            #{ad.strategyId},
+            #{ad.accountId},
+            #{ad.accountStatus},
+            #{ad.appId},
+            #{ad.clickTrackUrl},
+            #{ad.actionbarClickUrl},
+            #{ad.creativeCategory},
+            #{ad.creativeTag},
+            #{ad.useSchemaUri},
+            #{ad.schemaUri},
+            #{ad.population},
+            #{ad.excludePopulation},
+            #{ad.paidAudience}
+            )
+        </foreach>
+
+    </insert>
+</mapper>

+ 5 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/mapper/xml/KuaiShouDimensionAgeConfigMapper.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.dimension.mapper.KuaiShouDimensionAgeConfigMapper">
+
+</mapper>

+ 5 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/mapper/xml/KuaiShouDimensionCampaignMapper.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.dimension.mapper.KuaiShouDimensionCampaignMapper">
+
+</mapper>

+ 59 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/mapper/xml/KuaiShouDimensionCreativeMapper.xml

@@ -0,0 +1,59 @@
+<?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.dimension.mapper.KuaiShouDimensionCreativeMapper">
+
+    <insert id="addBatch">
+        insert into ctop_kuaishou_dimension_creative(
+        account_id,
+        strategy_id,
+        campaign_id,
+        unit_table_id,
+        creative_name,
+        photo_id,
+        creative_material_type,
+        action_bar_text,
+        description,
+        click_track_url,
+        actionbar_click_url,
+        creative_category,
+        creative_tag
+        )
+        values
+        <foreach collection="addList" item="ad" separator=",">
+            (
+            #{ad.accountId},
+            #{ad.strategyId},
+            #{ad.campaignId},
+            #{ad.unitTableId},
+            #{ad.creativeName},
+            #{ad.photoId},
+            #{ad.creativeMaterialType},
+            #{ad.actionBarText},
+            #{ad.description},
+            #{ad.clickTrackUrl},
+            #{ad.actionbarClickUrl},
+            #{ad.creativeCategory},
+            #{ad.creativeTag}
+            )
+        </foreach>
+    </insert>
+    <update id="updateBy">
+        UPDATE ctop_kuaishou_dimension_creative
+        SET create_status = 4,
+        create_describe = '当日创意创建超限'
+        where unit_table_id = #{unitTableId}
+        and create_status = 0
+
+    </update>
+    <delete id="removeByUnitTableIds">
+        delete from ctop_kuaishou_dimension_creative
+        where unit_table_id in
+        <foreach collection="ids" item="item" separator=","
+                 open="(" close=")">
+            #{item}
+        </foreach>
+    </delete>
+    <select id="getAccountList" resultType="java.lang.Long">
+        select DISTINCT account_id  from ctop_kuaishou_dimension_creative WHERE create_status = 4
+    </select>
+</mapper>

+ 72 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/mapper/xml/KuaiShouDimensionMaterialMapper.xml

@@ -0,0 +1,72 @@
+<?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.dimension.mapper.KuaiShouDimensionMaterialMapper">
+
+    <insert id="addBatch">
+        replace into ctop_kuaishou_dimension_material(
+        strategy_id,
+        photo_id
+
+        )
+        values
+        <foreach collection="addList" item="ad" separator=",">
+            (
+            #{ad.strategyId},
+            #{ad.photoId}
+
+            )
+        </foreach>
+
+    </insert>
+
+
+    <select id="getVideoList" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        t1.photo_id AS 'photoId',
+        t1.cover_url AS 'coverUrl',
+        t1.url AS 'photoUrl',
+        t1.channel_type AS 'channelType',
+        t1.stat_date AS 'statDate',
+        t1.photo_name AS 'photoName',
+        (
+        CASE
+        WHEN t2.id IS NULL THEN
+        1
+        ELSE
+        0
+        END
+        ) AS 'useStatus'
+        FROM
+        (
+        SELECT
+        *
+        FROM
+        ctop_kuaishou_video_get
+        WHERE
+        account_id = #{accountId}
+        <if test="startDate != null and startDate != '' ">
+            AND stat_date &gt;= #{startDate}
+        </if>
+        <if test="endDate != null and endDate != '' ">
+            AND stat_date &lt;= #{endDate}
+        </if>
+        ) t1
+        LEFT JOIN (
+        SELECT
+        id,
+        photo_id
+        FROM
+        ctop_kuaishou_dimension_material
+        where strategy_id = #{strategyId}
+        group by photo_id
+        ) t2 ON t1.photo_id = t2.photo_id
+        ORDER BY
+        t1.stat_date DESC
+    </select>
+    <select id="getSignatureByPhotoId" resultType="java.lang.String">
+        select  signature  from ctop_kuaishou_video_get
+        where photo_id = #{photoId}
+        and signature is  not null
+        limit 1
+    </select>
+</mapper>

+ 5 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/mapper/xml/KuaiShouDimensionRegionConfigMapper.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.dimension.mapper.KuaiShouDimensionRegionConfigMapper">
+
+</mapper>

+ 12 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/mapper/xml/KuaiShouDimensionRegionDetailMapper.xml

@@ -0,0 +1,12 @@
+<?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.dimension.mapper.KuaiShouDimensionRegionDetailMapper">
+
+    <select id="getRegionList" resultType="java.lang.Long">
+        select
+        region_id
+        from ctop_kuaishou_dimension_region_detail
+        where region_group_id = #{regionGroupId}
+
+    </select>
+</mapper>

+ 5 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/mapper/xml/KuaiShouDimensionStrategyMapper.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.dimension.mapper.KuaiShouDimensionStrategyMapper">
+
+</mapper>

+ 58 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/mapper/xml/KuaiShouDimensionUnitMapper.xml

@@ -0,0 +1,58 @@
+<?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.dimension.mapper.KuaiShouDimensionUnitMapper">
+    <update id="editBatch">
+        update ctop_kuaishou_dimension_unit
+        set submit_status = #{submitStatus}
+        where id in
+        <foreach collection="ids" item="item" separator=","
+                 open="(" close=")">
+            #{item}
+        </foreach>
+
+    </update>
+
+    <select id="getCampaignCount" resultType="com.alibaba.fastjson.JSONObject">
+       SELECT
+        t1.campaign_id as 'campaignId',
+        t2.campaign_type as 'campaignType',
+        t2.campaign_name as 'campaignName',
+        t2.day_budget as 'dayBudget'
+        from
+   	(
+		SELECT
+			campaign_id
+		FROM
+			ctop_kuaishou_dimension_unit
+		WHERE strategy_id = #{strategyId}
+		and account_id = #{accountId}
+		AND submit_status = 0
+		GROUP BY
+			campaign_id
+	) t1
+        LEFT JOIN (
+	    SELECT
+		*
+	    FROM
+		ctop_kuaishou_dimension_campaign
+	    WHERE  account_id = #{accountId}
+    )  t2
+        ON t1.campaign_id = t2.campaign_id
+
+    </select>
+    <select id="getUnitCount" resultType="java.lang.Integer">
+		SELECT
+			count(1) as 'count'
+		FROM
+			ctop_kuaishou_dimension_unit
+		WHERE strategy_id = #{strategyId}
+			and account_id = #{accountId}
+		AND submit_status = 0
+	</select>
+    <select id="getUnitCountByStrategyId" resultType="java.lang.Integer">
+		select  count(1) as 'count'  from
+		ctop_kuaishou_dimension_unit where strategy_id = #{strategyId}
+		and  submit_status = 0
+
+	</select>
+</mapper>

+ 5 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/mapper/xml/KuaiShouDimensionVariableMapper.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.dimension.mapper.KuaiShouDimensionVariableMapper">
+
+</mapper>

+ 30 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/service/IKuaiShouDimensionAccountService.java

@@ -0,0 +1,30 @@
+package cn.com.ctop.kuaishou.modules.dimension.service;
+
+import cn.com.ctop.kuaishou.modules.dimension.entity.KuaiShouDimensionAccount;
+import com.alibaba.fastjson.JSONArray;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import java.util.List;
+
+/**
+ * 多维度测试关联账户表
+ *
+ * @author jeecg-boot
+ * 2021-07-19
+ * @version V1.0
+ */
+public interface IKuaiShouDimensionAccountService extends IService<KuaiShouDimensionAccount> {
+
+    /**
+     * 添加策略关联账户信息
+     *
+     * @param id
+     * @param accountInfos
+     */
+    void insertAccountIds(Long id, JSONArray accountInfos, JSONArray creativeArray, JSONArray crowdArray);
+
+    List<KuaiShouDimensionAccount> getListByStrategyId(Long id, Integer accountStatus);
+
+
+    void removeByStrategyId(String id);
+}

+ 21 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/service/IKuaiShouDimensionAgeConfigService.java

@@ -0,0 +1,21 @@
+package cn.com.ctop.kuaishou.modules.dimension.service;
+
+import cn.com.ctop.kuaishou.modules.dimension.entity.KuaiShouDimensionAgeConfig;
+import com.alibaba.fastjson.JSONArray;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import java.util.Map;
+
+/**
+ * 素材多维度年龄配置
+ *
+ * @author jeecg-boot
+ * 2021-07-29
+ * @version V1.0
+ */
+public interface IKuaiShouDimensionAgeConfigService extends IService<KuaiShouDimensionAgeConfig> {
+
+    Map<String, JSONArray> getAgeMap();
+
+    Map<String, String> getAgeNameMap();
+}

+ 15 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/service/IKuaiShouDimensionCampaignService.java

@@ -0,0 +1,15 @@
+package cn.com.ctop.kuaishou.modules.dimension.service;
+
+import cn.com.ctop.kuaishou.modules.dimension.entity.KuaiShouDimensionCampaign;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * 素材多维度测试计划信息
+ *
+ * @author jeecg-boot
+ * 2021-07-24
+ * @version V1.0
+ */
+public interface IKuaiShouDimensionCampaignService extends IService<KuaiShouDimensionCampaign> {
+
+}

+ 26 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/service/IKuaiShouDimensionCreativeService.java

@@ -0,0 +1,26 @@
+package cn.com.ctop.kuaishou.modules.dimension.service;
+
+import cn.com.ctop.kuaishou.modules.dimension.entity.KuaiShouDimensionCreative;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import java.util.List;
+
+/**
+ * 多维度测试关联创意
+ *
+ * @author jeecg-boot
+ * 2021-07-22
+ * @version V1.0
+ */
+public interface IKuaiShouDimensionCreativeService extends IService<KuaiShouDimensionCreative> {
+
+    void addBatch(List<KuaiShouDimensionCreative> addList);
+
+    void createCreative(Long accountId, String accessToken, String id, Long unit);
+
+    void againCreateCreative(Long accountId, String accessToken);
+
+    List<Long> getAccountList();
+
+    void removeByUnitTableIds(List<String> strings);
+}

+ 25 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/service/IKuaiShouDimensionMaterialService.java

@@ -0,0 +1,25 @@
+package cn.com.ctop.kuaishou.modules.dimension.service;
+
+import cn.com.ctop.kuaishou.modules.dimension.entity.KuaiShouDimensionMaterial;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.github.pagehelper.PageInfo;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 多维度测试素材列表
+ *
+ * @author jeecg-boot
+ * 2021-07-23
+ * @version V1.0
+ */
+public interface IKuaiShouDimensionMaterialService extends IService<KuaiShouDimensionMaterial> {
+
+    void addBatch(List<KuaiShouDimensionMaterial> dimensionMaterials);
+
+    PageInfo<List<JSONObject>> getVideoList(Map<String, Object> requestMap, Integer pageNo, Integer pageSize);
+
+    String getSignatureByPhotoId(Long photoId);
+}

+ 18 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/service/IKuaiShouDimensionRegionConfigService.java

@@ -0,0 +1,18 @@
+package cn.com.ctop.kuaishou.modules.dimension.service;
+
+import cn.com.ctop.kuaishou.modules.dimension.entity.KuaiShouDimensionRegionConfig;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import java.util.List;
+
+/**
+ * 地域配置
+ *
+ * @author jeecg-boot
+ * 2021-07-21
+ * @version V1.0
+ */
+public interface IKuaiShouDimensionRegionConfigService extends IService<KuaiShouDimensionRegionConfig> {
+
+    List<KuaiShouDimensionRegionConfig> getConfigList();
+}

+ 22 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/service/IKuaiShouDimensionRegionDetailService.java

@@ -0,0 +1,22 @@
+package cn.com.ctop.kuaishou.modules.dimension.service;
+
+import cn.com.ctop.kuaishou.modules.dimension.entity.KuaiShouDimensionRegionDetail;
+import com.alibaba.fastjson.JSONArray;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import java.util.Map;
+
+/**
+ * 地域
+ *
+ * @author jeecg-boot
+ * 2021-07-21
+ * @version V1.0
+ */
+public interface IKuaiShouDimensionRegionDetailService extends IService<KuaiShouDimensionRegionDetail> {
+
+
+    Map<String, JSONArray> getRegionList();
+
+    Map<String, String> getRegionNameList();
+}

+ 20 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/service/IKuaiShouDimensionStrategyService.java

@@ -0,0 +1,20 @@
+package cn.com.ctop.kuaishou.modules.dimension.service;
+
+import cn.com.ctop.kuaishou.modules.dimension.entity.KuaiShouDimensionStrategy;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * 多维度测试策略表
+ *
+ * @author jeecg-boot
+ * 2021-07-19
+ * @version V1.0
+ */
+public interface IKuaiShouDimensionStrategyService extends IService<KuaiShouDimensionStrategy> {
+
+    void insertStrategy(String userId, JSONObject strategyJson);
+
+    JSONObject create(Long id, JSONArray materialArray);
+}

+ 32 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/service/IKuaiShouDimensionUnitService.java

@@ -0,0 +1,32 @@
+package cn.com.ctop.kuaishou.modules.dimension.service;
+
+import cn.com.ctop.kuaishou.modules.dimension.entity.KuaiShouDimensionUnit;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import java.util.List;
+
+/**
+ * 多维度测试组列表
+ *
+ * @author jeecg-boot
+ * 2021-07-22
+ * @version V1.0
+ */
+public interface IKuaiShouDimensionUnitService extends IService<KuaiShouDimensionUnit> {
+
+    void createUnit(Long strategyId, Long accountId, String accessToken);
+
+    Boolean getCreateOverrun(Long account);
+
+    List<JSONObject> getCampaignCount(Long accountId, Long strategyId);
+
+    Integer getUnitCount(Long accountId, Long strategyId);
+
+    List<KuaiShouDimensionUnit> getUnitListBy(Long strategyId, Long accountId, Long campaignId);
+
+    void editBatch(Integer submitStatus, JSONArray ids);
+
+    Integer getUnitCountByStrategyId(Long strategyId);
+}

+ 19 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/service/IKuaiShouDimensionVariableService.java

@@ -0,0 +1,19 @@
+package cn.com.ctop.kuaishou.modules.dimension.service;
+
+import cn.com.ctop.kuaishou.modules.dimension.entity.KuaiShouDimensionVariable;
+import com.alibaba.fastjson.JSONArray;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * 多维度测试变量配置
+ *
+ * @author jeecg-boot
+ * 2021-07-20
+ * @version V1.0
+ */
+public interface IKuaiShouDimensionVariableService extends IService<KuaiShouDimensionVariable> {
+
+    JSONArray getDimensionVariableList(Long strategyId);
+
+    void removeByStrategyId(String id);
+}

+ 150 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/service/impl/KuaiShouDimensionAccountServiceImpl.java

@@ -0,0 +1,150 @@
+package cn.com.ctop.kuaishou.modules.dimension.service.impl;
+
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.kuaishou.modules.dimension.entity.KuaiShouDimensionAccount;
+import cn.com.ctop.kuaishou.modules.dimension.mapper.KuaiShouDimensionAccountMapper;
+import cn.com.ctop.kuaishou.modules.dimension.service.IKuaiShouDimensionAccountService;
+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 org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 多维度测试关联账户表
+ *
+ * @author jeecg-boot
+ * 2021-07-19
+ * @version V1.0
+ */
+@Service
+public class KuaiShouDimensionAccountServiceImpl extends ServiceImpl<KuaiShouDimensionAccountMapper, KuaiShouDimensionAccount> implements IKuaiShouDimensionAccountService {
+    @Autowired
+    private KuaiShouDimensionAccountMapper dimensionAccountMapper;
+
+    @Override
+    public void insertAccountIds(Long id, JSONArray accountInfos, JSONArray creativeArray, JSONArray crowdArray) {
+
+        QueryWrapper<KuaiShouDimensionAccount> dimensionAccountQueryWrapper = new QueryWrapper<>();
+        dimensionAccountQueryWrapper.eq("strategy_id", id);
+        this.remove(dimensionAccountQueryWrapper);
+        Map<Long, JSONObject> creativeMap = new HashMap<>();
+        if (!Check.isNull(creativeArray)) {
+            for (int i = 0; i < creativeArray.size(); i++) {
+                JSONObject creativeJson = creativeArray.getJSONObject(i);
+                Long accountId = creativeJson.getLong("accountId");
+                creativeMap.put(accountId, creativeJson);
+            }
+        }
+        Map<Long, JSONObject> crowdMap = new HashMap<>();
+        if (!Check.isNull(crowdArray)) {
+            for (int i = 0; i < crowdArray.size(); i++) {
+                JSONObject jsonObject = crowdArray.getJSONObject(i);
+                Long accountId = jsonObject.getLong("accountId");
+                crowdMap.put(accountId, jsonObject);
+            }
+        }
+
+        List<KuaiShouDimensionAccount> addList = new ArrayList<>();
+        for (int i = 0; i < accountInfos.size(); i++) {
+            JSONObject jsonObject = accountInfos.getJSONObject(i);
+            if (Check.isNull(jsonObject)) {
+                continue;
+            }
+            Long accountId = jsonObject.getLong("accountId");
+            KuaiShouDimensionAccount dimensionAccount = new KuaiShouDimensionAccount();
+            dimensionAccount.setStrategyId(id);
+            dimensionAccount.setAccountId(accountId);
+            Integer accountStatus = jsonObject.getInteger("accountStatus");
+            if (Check.isNull(accountStatus)) {
+                dimensionAccount.setAccountStatus(0);
+            } else {
+                dimensionAccount.setAccountStatus(accountStatus);
+            }
+            if (!Check.isNull(jsonObject.getLong("appId"))) {
+                dimensionAccount.setAppId(jsonObject.getLong("appId"));
+            }
+            if (!Check.isNull(jsonObject.getString("clickTrackUrl"))) {
+                dimensionAccount.setClickTrackUrl(jsonObject.getString("clickTrackUrl"));
+            }
+            if (!Check.isNull(jsonObject.getString("actionbarClickUrl"))) {
+                dimensionAccount.setActionbarClickUrl(jsonObject.getString("actionbarClickUrl"));
+            }
+            if (!Check.isNull(jsonObject.getInteger("useSchemaUri"))) {
+                dimensionAccount.setUseSchemaUri(jsonObject.getInteger("useSchemaUri"));
+            }
+            if (!Check.isNull(jsonObject.getString("schemaUri"))) {
+                dimensionAccount.setSchemaUri(jsonObject.getString("schemaUri"));
+            }
+            if (!Check.isNullMap(creativeMap)) {
+                JSONObject creativeJson = creativeMap.get(accountId);
+                if (!Check.isNull(creativeJson)) {
+                    if (!Check.isNull(creativeJson.getInteger("creativeCategory"))) {
+                        dimensionAccount.setCreativeCategory(creativeJson.getInteger("creativeCategory"));
+                    }
+                    if (!Check.isNull(creativeJson.getJSONArray("creativeTag"))) {
+                        dimensionAccount.setCreativeTag(creativeJson.getString("creativeTag"));
+                    }
+                }
+            }
+
+            if (!Check.isNullMap(crowdMap)) {
+                JSONObject crowdJson = crowdMap.get(accountId);
+                if (!Check.isNull(crowdJson)) {
+                    JSONArray population = crowdJson.getJSONArray("population");
+                    if (!Check.isNull(population)) {
+                        dimensionAccount.setPopulation(population.toJSONString());
+                    }
+                    JSONArray excludePopulation = crowdJson.getJSONArray("excludePopulation");
+                    if (!Check.isNull(excludePopulation)) {
+                        dimensionAccount.setExcludePopulation(excludePopulation.toJSONString());
+                    }
+
+                    JSONArray paidAudience = crowdJson.getJSONArray("paidAudience");
+                    if (!Check.isNull(paidAudience)) {
+                        dimensionAccount.setPaidAudience(paidAudience.toJSONString());
+                    }
+                }
+            }
+
+            addList.add(dimensionAccount);
+        }
+        if (!Check.isNull(addList)) {
+            dimensionAccountMapper.addBatch(addList);
+
+        }
+
+    }
+
+    /**
+     * 根据策略id查询所有关联账户
+     *
+     * @param id
+     * @return
+     */
+    @Override
+    public List<KuaiShouDimensionAccount> getListByStrategyId(Long id, Integer accountStatus) {
+        QueryWrapper<KuaiShouDimensionAccount> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("strategy_id", id);
+        if (!Check.isNull(accountStatus)) {
+            queryWrapper.eq("account_status", accountStatus);
+        }
+
+        return this.list(queryWrapper);
+    }
+
+    @Override
+    public void removeByStrategyId(String id) {
+        QueryWrapper<KuaiShouDimensionAccount> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("strategy_id", id);
+        dimensionAccountMapper.delete(queryWrapper);
+    }
+
+
+}

+ 49 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/service/impl/KuaiShouDimensionAgeConfigServiceImpl.java

@@ -0,0 +1,49 @@
+package cn.com.ctop.kuaishou.modules.dimension.service.impl;
+
+import cn.com.ctop.kuaishou.modules.dimension.entity.KuaiShouDimensionAgeConfig;
+import cn.com.ctop.kuaishou.modules.dimension.mapper.KuaiShouDimensionAgeConfigMapper;
+import cn.com.ctop.kuaishou.modules.dimension.service.IKuaiShouDimensionAgeConfigService;
+import com.alibaba.fastjson.JSONArray;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 素材多维度年龄配置
+ *
+ * @author jeecg-boot
+ * 2021-07-29
+ * @version V1.0
+ */
+@Service
+public class KuaiShouDimensionAgeConfigServiceImpl extends ServiceImpl<KuaiShouDimensionAgeConfigMapper, KuaiShouDimensionAgeConfig> implements IKuaiShouDimensionAgeConfigService {
+
+    @Override
+    public Map<String, JSONArray> getAgeMap() {
+        Map<String, JSONArray> map = new HashMap<>();
+        QueryWrapper<KuaiShouDimensionAgeConfig> ageConfigQueryWrapper = new QueryWrapper<>();
+        List<KuaiShouDimensionAgeConfig> list = this.list(ageConfigQueryWrapper);
+        for (KuaiShouDimensionAgeConfig ageConfig : list) {
+            map.put(ageConfig.getAgeGroupId(), JSONArray.parseArray(ageConfig.getAgeGroupValue()));
+
+        }
+
+        return map;
+    }
+
+    @Override
+    public Map<String, String> getAgeNameMap() {
+        Map<String, String> map = new HashMap<>();
+        QueryWrapper<KuaiShouDimensionAgeConfig> ageConfigQueryWrapper = new QueryWrapper<>();
+        List<KuaiShouDimensionAgeConfig> list = this.list(ageConfigQueryWrapper);
+        for (KuaiShouDimensionAgeConfig ageConfig : list) {
+            map.put(ageConfig.getAgeGroupId(), ageConfig.getAgeGroupName());
+        }
+
+        return map;
+    }
+}

+ 23 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/service/impl/KuaiShouDimensionCampaignServiceImpl.java

@@ -0,0 +1,23 @@
+package cn.com.ctop.kuaishou.modules.dimension.service.impl;
+
+import cn.com.ctop.kuaishou.modules.dimension.entity.KuaiShouDimensionCampaign;
+import cn.com.ctop.kuaishou.modules.dimension.mapper.KuaiShouDimensionCampaignMapper;
+import cn.com.ctop.kuaishou.modules.dimension.service.IKuaiShouDimensionCampaignService;
+import com.alibaba.fastjson.JSONArray;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+/**
+ * 素材多维度测试计划信息
+ *
+ * @author jeecg-boot
+ * 2021-07-24
+ * @version V1.0
+ */
+@Service
+public class KuaiShouDimensionCampaignServiceImpl extends ServiceImpl<KuaiShouDimensionCampaignMapper, KuaiShouDimensionCampaign> implements IKuaiShouDimensionCampaignService {
+
+
+
+}

+ 221 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/service/impl/KuaiShouDimensionCreativeServiceImpl.java

@@ -0,0 +1,221 @@
+package cn.com.ctop.kuaishou.modules.dimension.service.impl;
+
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
+import cn.com.ctop.kuaishou.modules.dimension.entity.KuaiShouDimensionCreative;
+import cn.com.ctop.kuaishou.modules.dimension.mapper.KuaiShouDimensionCreativeMapper;
+import cn.com.ctop.kuaishou.modules.dimension.service.IKuaiShouDimensionCreativeService;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+/**
+ * 多维度测试关联创意
+ *
+ * @author jeecg-boot
+ * 2021-07-22
+ * @version V1.0
+ */
+@Slf4j
+@Service
+public class KuaiShouDimensionCreativeServiceImpl extends ServiceImpl<KuaiShouDimensionCreativeMapper, KuaiShouDimensionCreative> implements IKuaiShouDimensionCreativeService {
+    @Autowired
+    private KuaiShouDimensionCreativeMapper dimensionCreativeMapper;
+    static ExecutorService createCreativeService = Executors.newFixedThreadPool(5);
+    @Autowired
+    private IKuaishouInterfaceService kuaishouInterfaceService;
+
+    @Override
+    public void addBatch(List<KuaiShouDimensionCreative> addList) {
+        dimensionCreativeMapper.addBatch(addList);
+    }
+
+    /**
+     * 创意创建
+     *
+     * @param accountId
+     * @param accessToken
+     * @param id
+     * @param unitId
+     */
+    @Override
+    public void createCreative(Long accountId, String accessToken, String id, Long unitId) {
+        createCreativeService.submit(new Runnable() {
+            @Override
+            public void run() {
+                QueryWrapper<KuaiShouDimensionCreative> updateCreativeQueryWrapper = new QueryWrapper<>();
+                updateCreativeQueryWrapper.eq("unit_table_id", id);
+                KuaiShouDimensionCreative updateDimensionCreative = new KuaiShouDimensionCreative();
+                updateDimensionCreative.setUnitId(unitId);
+                int update = dimensionCreativeMapper.update(updateDimensionCreative, updateCreativeQueryWrapper);
+                if (update > 0) {
+                    log.info("修改创意关联unit成功,tableId:{},unitId:{}", id, unitId);
+                }
+                QueryWrapper<KuaiShouDimensionCreative> creativeQueryWrapper = new QueryWrapper<>();
+                creativeQueryWrapper.eq("unit_table_id", id);
+                creativeQueryWrapper.eq("create_status", 0);
+                List<KuaiShouDimensionCreative> dimensionCreatives = dimensionCreativeMapper.selectList(creativeQueryWrapper);
+                if (!Check.isNull(dimensionCreatives)) {
+                    for (KuaiShouDimensionCreative creative : dimensionCreatives) {
+                        KuaiShouDimensionCreative updateCreative = new KuaiShouDimensionCreative();
+                        updateCreative.setId(creative.getId());
+                        updateCreative.setCreateStatus(1);
+                        updateCreative.setCreateDescribe("创建中");
+                        dimensionCreativeMapper.updateById(updateCreative);
+                        JSONObject creativeJson = new JSONObject();
+                        creativeJson.put("advertiser_id", accountId);
+                        creativeJson.put("unit_id", unitId);
+                        Integer creativeMaterialType = creative.getCreativeMaterialType();
+                        creativeJson.put("creative_material_type", creativeMaterialType);
+                        String action_bar_text = creative.getActionBarText();
+                        creativeJson.put("action_bar_text", action_bar_text);
+                        String description = creative.getDescription();
+                        creativeJson.put("description", description.trim());
+                        String name = creative.getCreativeName();
+                        creativeJson.put("creative_name", name);
+                        Long photoId = creative.getPhotoId();
+                        if (!Check.isNull(photoId)) {
+                            creativeJson.put("photo_id", photoId);
+                        }
+                        if (!Check.isNull(creative.getCreativeCategory())) {
+                            creativeJson.put("creative_category", creative.getCreativeCategory());
+                        }
+                        if (!Check.isNull(!Check.isNull(creative.getCreativeTag()))) {
+                            creativeJson.put("creative_tag", JSONArray.parseArray(creative.getCreativeTag()));
+                        }
+                        String click_track_url = creative.getClickTrackUrl();
+                        if (!Check.isNull(click_track_url)) {
+                            creativeJson.put("click_track_url", click_track_url);
+                        }
+                        // 第三方点击按钮监测链接
+                        if (!Check.isNull(creative.getActionbarClickUrl())) {
+                            creativeJson.put("actionbar_click_url", creative.getActionbarClickUrl());
+                        }
+                        Map<String, Object> creativeMap = kuaishouInterfaceService.creativeCreate(accessToken, accountId, creativeJson, 1);
+                        if (!Check.isNullMap(creativeMap)) {
+                            Integer code = (Integer) creativeMap.get("code");
+                            if (code == 0) {
+                                Long creativeId = (Long) creativeMap.get("creativeId");
+                                updateCreative.setCreativeId(creativeId);
+                                updateCreative.setCreateStatus(2);
+                                updateCreative.setCreateDescribe("创建成功");
+                                dimensionCreativeMapper.updateById(updateCreative);
+
+                            } else {
+                                String message = (String) creativeMap.get("message");
+                                if ("/rest/openapi/v2/creative/create调用已超日限,次日可恢复调用".equals(message)) {
+                                    updateCreative.setCreateStatus(4);
+                                    updateCreative.setCreateDescribe("当日创意额度超限");
+                                    dimensionCreativeMapper.updateById(updateCreative);
+                                    dimensionCreativeMapper.updateBy(id);
+                                    return;
+                                } else {
+                                    updateCreative.setCreateStatus(3);
+                                    updateCreative.setCreateDescribe(message);
+                                    dimensionCreativeMapper.updateById(updateCreative);
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        });
+    }
+
+    /**
+     * 重新提交创意
+     *
+     * @param accountId
+     * @param accessToken
+     */
+    @Override
+    public void againCreateCreative(Long accountId, String accessToken) {
+        QueryWrapper<KuaiShouDimensionCreative> creativeQueryWrapper = new QueryWrapper<>();
+        creativeQueryWrapper.eq("account_id", accountId);
+        creativeQueryWrapper.eq("create_status", 4);
+        List<KuaiShouDimensionCreative> dimensionCreatives = dimensionCreativeMapper.selectList(creativeQueryWrapper);
+        if (!Check.isNull(dimensionCreatives)) {
+            for (KuaiShouDimensionCreative creative : dimensionCreatives) {
+                KuaiShouDimensionCreative updateCreative = new KuaiShouDimensionCreative();
+                updateCreative.setId(creative.getId());
+                updateCreative.setCreateStatus(1);
+                updateCreative.setCreateDescribe("创建中");
+                dimensionCreativeMapper.updateById(updateCreative);
+                JSONObject creativeJson = new JSONObject();
+                creativeJson.put("advertiser_id", accountId);
+                creativeJson.put("unit_id", creative.getUnitId());
+                Integer creativeMaterialType = creative.getCreativeMaterialType();
+                creativeJson.put("creative_material_type", creativeMaterialType);
+                String action_bar_text = creative.getActionBarText();
+                creativeJson.put("action_bar_text", action_bar_text);
+                String description = creative.getDescription();
+                creativeJson.put("description", description.trim());
+                String name = creative.getCreativeName();
+                creativeJson.put("creative_name", name);
+                Long photoId = creative.getPhotoId();
+                if (!Check.isNull(photoId)) {
+                    creativeJson.put("photo_id", photoId);
+                }
+                if (!Check.isNull(creative.getCreativeCategory())) {
+                    creativeJson.put("creative_category", creative.getCreativeCategory());
+                }
+                if (!Check.isNull(!Check.isNull(creative.getCreativeTag()))) {
+                    creativeJson.put("creative_tag", JSONArray.parseArray(creative.getCreativeTag()));
+                }
+                String click_track_url = creative.getClickTrackUrl();
+                if (!Check.isNull(click_track_url)) {
+                    creativeJson.put("click_track_url", click_track_url);
+                }
+                // 第三方点击按钮监测链接
+                if (!Check.isNull(creative.getActionbarClickUrl())) {
+                    creativeJson.put("actionbar_click_url", creative.getActionbarClickUrl());
+                }
+                Map<String, Object> creativeMap = kuaishouInterfaceService.creativeCreate(accessToken, accountId, creativeJson, 1);
+                if (!Check.isNullMap(creativeMap)) {
+                    Integer code = (Integer) creativeMap.get("code");
+                    if (code == 0) {
+                        Long creativeId = (Long) creativeMap.get("creativeId");
+                        updateCreative.setCreativeId(creativeId);
+                        updateCreative.setCreateStatus(2);
+                        updateCreative.setCreateDescribe("创建成功");
+                        dimensionCreativeMapper.updateById(updateCreative);
+
+                    } else {
+                        String message = (String) creativeMap.get("message");
+                        if ("/rest/openapi/v2/creative/create调用已超日限,次日可恢复调用".equals(message)) {
+                            updateCreative.setCreateStatus(4);
+                            updateCreative.setCreateDescribe("当日创意额度超限");
+                            dimensionCreativeMapper.updateById(updateCreative);
+                            dimensionCreativeMapper.updateBy(creative.getUnitTableId());
+                            return;
+                        } else {
+                            updateCreative.setCreateStatus(3);
+                            updateCreative.setCreateDescribe(message);
+                            dimensionCreativeMapper.updateById(updateCreative);
+                        }
+                    }
+                }
+            }
+        }
+    }
+
+    @Override
+    public List<Long> getAccountList() {
+        return dimensionCreativeMapper.getAccountList();
+    }
+
+    @Override
+    public void removeByUnitTableIds(List<String> strings) {
+        dimensionCreativeMapper.removeByUnitTableIds(strings);
+    }
+
+}

+ 46 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/service/impl/KuaiShouDimensionMaterialServiceImpl.java

@@ -0,0 +1,46 @@
+package cn.com.ctop.kuaishou.modules.dimension.service.impl;
+
+import cn.com.ctop.kuaishou.modules.dimension.entity.KuaiShouDimensionMaterial;
+import cn.com.ctop.kuaishou.modules.dimension.mapper.KuaiShouDimensionMaterialMapper;
+import cn.com.ctop.kuaishou.modules.dimension.service.IKuaiShouDimensionMaterialService;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 多维度测试素材列表
+ *
+ * @author jeecg-boot
+ * 2021-07-23
+ * @version V1.0
+ */
+@Service
+public class KuaiShouDimensionMaterialServiceImpl extends ServiceImpl<KuaiShouDimensionMaterialMapper, KuaiShouDimensionMaterial> implements IKuaiShouDimensionMaterialService {
+    @Autowired
+    private KuaiShouDimensionMaterialMapper dimensionMaterialMapper;
+
+    @Override
+    public void addBatch(List<KuaiShouDimensionMaterial> dimensionMaterials) {
+        dimensionMaterialMapper.addBatch(dimensionMaterials);
+    }
+
+    @Override
+    public PageInfo<List<JSONObject>> getVideoList(Map<String, Object> requestMap, Integer pageNo, Integer pageSize) {
+        PageHelper.startPage(pageNo, pageSize);
+
+        PageInfo pageInfo = new PageInfo(dimensionMaterialMapper.getVideoList(requestMap));
+        return pageInfo;
+
+    }
+
+    @Override
+    public String getSignatureByPhotoId(Long photoId) {
+        return dimensionMaterialMapper.getSignatureByPhotoId(photoId);
+    }
+}

+ 27 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/service/impl/KuaiShouDimensionRegionConfigServiceImpl.java

@@ -0,0 +1,27 @@
+package cn.com.ctop.kuaishou.modules.dimension.service.impl;
+
+import cn.com.ctop.kuaishou.modules.dimension.entity.KuaiShouDimensionRegionConfig;
+import cn.com.ctop.kuaishou.modules.dimension.mapper.KuaiShouDimensionRegionConfigMapper;
+import cn.com.ctop.kuaishou.modules.dimension.service.IKuaiShouDimensionRegionConfigService;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * 地域配置
+ *
+ * @author jeecg-boot
+ * 2021-07-21
+ * @version V1.0
+ */
+@Service
+public class KuaiShouDimensionRegionConfigServiceImpl extends ServiceImpl<KuaiShouDimensionRegionConfigMapper, KuaiShouDimensionRegionConfig> implements IKuaiShouDimensionRegionConfigService {
+
+    @Override
+    public List<KuaiShouDimensionRegionConfig> getConfigList() {
+        QueryWrapper<KuaiShouDimensionRegionConfig> queryWrapper = new QueryWrapper<>();
+        return this.list(queryWrapper);
+    }
+}

+ 58 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/service/impl/KuaiShouDimensionRegionDetailServiceImpl.java

@@ -0,0 +1,58 @@
+package cn.com.ctop.kuaishou.modules.dimension.service.impl;
+
+import cn.com.ctop.kuaishou.modules.dimension.entity.KuaiShouDimensionRegionConfig;
+import cn.com.ctop.kuaishou.modules.dimension.entity.KuaiShouDimensionRegionDetail;
+import cn.com.ctop.kuaishou.modules.dimension.mapper.KuaiShouDimensionRegionDetailMapper;
+import cn.com.ctop.kuaishou.modules.dimension.service.IKuaiShouDimensionRegionConfigService;
+import cn.com.ctop.kuaishou.modules.dimension.service.IKuaiShouDimensionRegionDetailService;
+import com.alibaba.fastjson.JSONArray;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 地域
+ *
+ * @author jeecg-boot
+ * 2021-07-21
+ * @version V1.0
+ */
+@Service
+public class KuaiShouDimensionRegionDetailServiceImpl extends ServiceImpl<KuaiShouDimensionRegionDetailMapper, KuaiShouDimensionRegionDetail> implements IKuaiShouDimensionRegionDetailService {
+    @Autowired
+    KuaiShouDimensionRegionDetailMapper dimensionRegionDetailMapper;
+    @Autowired
+    private IKuaiShouDimensionRegionConfigService dimensionRegionConfigService;
+
+
+    @Override
+    public Map<String, JSONArray> getRegionList() {
+        Map<String, JSONArray> regionMap = new HashMap<>();
+
+        List<KuaiShouDimensionRegionConfig> configs = dimensionRegionConfigService.getConfigList();
+        for (KuaiShouDimensionRegionConfig config : configs) {
+            String regionGroupId = config.getRegionGroupId();
+            List<Long> regionList = dimensionRegionDetailMapper.getRegionList(regionGroupId);
+            regionMap.put(regionGroupId, JSONArray.parseArray(regionList.toString()));
+        }
+
+        return regionMap;
+    }
+
+    @Override
+    public Map<String, String> getRegionNameList() {
+        Map<String, String> nameMap = new HashMap<>();
+        List<KuaiShouDimensionRegionConfig> configs = dimensionRegionConfigService.getConfigList();
+        for (KuaiShouDimensionRegionConfig config : configs) {
+            String regionGroupId = config.getRegionGroupId();
+            nameMap.put(regionGroupId, config.getRegionGroupName());
+        }
+        return nameMap;
+    }
+
+
+}

+ 794 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/service/impl/KuaiShouDimensionStrategyServiceImpl.java

@@ -0,0 +1,794 @@
+package cn.com.ctop.kuaishou.modules.dimension.service.impl;
+
+import cn.com.ctop.common.module.entity.CtopOauthToken;
+import cn.com.ctop.common.module.service.ICtopOauthTokenService;
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.kuaishou.modules.ai.enums.KuaishouCreativeAdsenceTypeEnum;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouAppList;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouVideoGet;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouAppListService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouVideoGetService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
+import cn.com.ctop.kuaishou.modules.dimension.entity.*;
+import cn.com.ctop.kuaishou.modules.dimension.mapper.KuaiShouDimensionStrategyMapper;
+import cn.com.ctop.kuaishou.modules.dimension.service.*;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.google.common.collect.Lists;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.util.DateUtils;
+import org.jeecg.common.util.RedisUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.math.BigDecimal;
+import java.util.*;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+/**
+ * 多维度测试策略表
+ *
+ * @author jeecg-boot
+ * 2021-07-19
+ * @version V1.0
+ */
+@Slf4j
+@Service
+public class KuaiShouDimensionStrategyServiceImpl extends ServiceImpl<KuaiShouDimensionStrategyMapper, KuaiShouDimensionStrategy> implements IKuaiShouDimensionStrategyService {
+
+    @Autowired
+    private KuaiShouDimensionStrategyMapper dimensionStrategyMapper;
+    @Autowired
+    private IKuaiShouDimensionAccountService dimensionAccountService;
+    @Autowired
+    private IKuaiShouDimensionVariableService dimensionVariableService;
+    @Autowired
+    private ICtopOauthTokenService oauthTokenService;
+    @Autowired
+    private IKuaishouInterfaceService kuaishouInterfaceService;
+    @Autowired
+    private IKuaiShouDimensionRegionDetailService dimensionRegionDetailService;
+    @Autowired
+    private IKuaiShouDimensionUnitService dimensionUnitService;
+    @Autowired
+    private IKuaiShouAppListService appListService;
+    @Autowired
+    private IKuaiShouVideoGetService videoGetService;
+    @Autowired
+    private IKuaiShouDimensionCreativeService dimensionCreativeService;
+    @Autowired
+    private IKuaiShouDimensionCampaignService dimensionCampaignService;
+    @Autowired
+    private IKuaiShouDimensionAgeConfigService dimensionAgeConfigService;
+
+    @Autowired
+    private RedisUtil redisUtil;
+    private static Map<String, JSONArray> regionMap = new HashMap();
+    private static Map<String, String> regionNameMap = new HashMap();
+    private static Map<String, JSONArray> ageMap = new HashMap();
+    private static Map<String, String> ageNameMap = new HashMap();
+    private static String in_use_key = "dimension_in_use_campaign_id_";
+    private static String account_count_key = "now_date_account_create_campaign_count_";
+    private static String campaign_relation_unit = "campaign_relation_unit_";
+    static ExecutorService addUnitService = Executors.newFixedThreadPool(5);
+    static ExecutorService addCreativeService = Executors.newFixedThreadPool(5);
+
+
+    /**
+     * 多维度测试策略信息入库
+     *
+     * @param strategyJson
+     */
+    @Override
+    public void insertStrategy(String userId, JSONObject strategyJson) {
+
+        KuaiShouDimensionStrategy dimensionStrategy = new KuaiShouDimensionStrategy();
+
+        dimensionStrategy.setUserId(userId);
+        Long id = strategyJson.getLong("id"); // 主键id
+        if (!Check.isNull(id)) {
+            dimensionStrategy.setId(id);
+        }
+        String strategyName = strategyJson.getString("strategyName"); // 策略名称
+        if (!Check.isNull(strategyName)) {
+            dimensionStrategy.setStrategyName(strategyName);
+        }
+        Integer strategyStatus = strategyJson.getInteger("strategyStatus"); //  策略状态
+        if (!Check.isNull(strategyStatus)) {
+            dimensionStrategy.setStrategyStatus(strategyStatus);
+        }
+        Integer campaignType = strategyJson.getInteger("campaignType"); //  计划类型
+        if (!Check.isNull(campaignType)) {
+            dimensionStrategy.setCampaignType(campaignType);
+        }
+        String campaignName = strategyJson.getString("campaignName"); //  计划名称
+        if (!Check.isNull(campaignName)) {
+            dimensionStrategy.setCampaignName(campaignName);
+        }
+        Long campaignDayBudget = strategyJson.getLong("campaignDayBudget"); //  计划预算
+        if (campaignDayBudget != null) {
+            dimensionStrategy.setCampaignDayBudget(campaignDayBudget);
+        }
+        String unitName = strategyJson.getString("unitName"); //  组名称
+        if (!Check.isNull(unitName)) {
+            dimensionStrategy.setUnitName(unitName);
+        }
+        Long unitDayBudget = strategyJson.getLong("unitDayBudget"); //  组预算
+        if (unitDayBudget != null) {
+            dimensionStrategy.setUnitDayBudget(unitDayBudget);
+        }
+
+        Integer network = strategyJson.getInteger("network"); //  网络环境
+        if (!Check.isNull(network)) {
+            dimensionStrategy.setNetwork(network);
+        }
+        String fansStar = strategyJson.getString("fansStar"); //  网红粉丝
+        if (!Check.isNull(fansStar)) {
+            dimensionStrategy.setFansStar(fansStar);
+        }
+        Integer filterConvertedLevel = strategyJson.getInteger("filterConvertedLevel"); //  过滤转化人群
+        if (!Check.isNull(filterConvertedLevel)) {
+            dimensionStrategy.setFilterConvertedLevel(filterConvertedLevel);
+        }
+        String deviceBrand = strategyJson.getString("deviceBrand"); //  设备品牌
+        if (!Check.isNull(deviceBrand)) {
+            dimensionStrategy.setDeviceBrand(deviceBrand);
+        }
+        String devicePrice = strategyJson.getString("devicePrice"); //  设备价格
+        if (!Check.isNull(devicePrice)) {
+            dimensionStrategy.setDevicePrice(devicePrice);
+        }
+
+        Integer bidType = strategyJson.getInteger("bidType"); //  优化目标
+        if (!Check.isNull(bidType)) {
+            dimensionStrategy.setBidType(bidType);
+        }
+        Integer ocpxActionType = strategyJson.getInteger("ocpxActionType"); //  转化目标
+        if (!Check.isNull(ocpxActionType)) {
+            dimensionStrategy.setOcpxActionType(ocpxActionType);
+        }
+        Integer deepConversionType = strategyJson.getInteger("deepConversionType"); //  深度转化目标
+        if (Check.isNull(deepConversionType)) {
+            dimensionStrategy.setDeepConversionType(deepConversionType);
+        }
+        Long bid = strategyJson.getLong("bid"); //  出价
+        if (!Check.isNull(bid)) {
+            dimensionStrategy.setBid(bid);
+        }
+        String cpaBid = strategyJson.getString("cpaBid"); //  cpa_bid出价
+        if (!Check.isNull(cpaBid)) {
+            dimensionStrategy.setCpaBid(cpaBid);
+        }
+        Long deepConversionBid = strategyJson.getLong("deepConversionBid"); //  深度转化出价
+        if (!Check.isNull(deepConversionBid)) {
+            dimensionStrategy.setDeepConversionBid(deepConversionBid);
+        }
+        JSONArray sceneId = strategyJson.getJSONArray("sceneId"); //  资源位置
+        if (!Check.isNull(sceneId)) {
+            dimensionStrategy.setSceneId(sceneId.toJSONString());
+        }
+        JSONArray actionBarText = strategyJson.getJSONArray("actionBarText"); //  行动号召按钮
+        if (!Check.isNull(actionBarText)) {
+            dimensionStrategy.setActionBarText(actionBarText.toJSONString());
+        }
+        JSONArray description = strategyJson.getJSONArray("description"); //  广告语
+        if (!Check.isNull(description)) {
+            dimensionStrategy.setDescription(description.toJSONString());
+        }
+        Integer unitNum = strategyJson.getInteger("unitNum"); // 计划下组数量
+        if (!Check.isNull(unitNum)) {
+            dimensionStrategy.setUnitNum(unitNum);
+        }
+        Integer materialNum = strategyJson.getInteger("materialNum"); // 组下素材量
+        if (!Check.isNull(materialNum)) {
+            dimensionStrategy.setMaterialNum(materialNum);
+        }
+        Integer useAppMarket = strategyJson.getInteger("useAppMarket"); // 优先从应用商店下载
+        if (!Check.isNull(useAppMarket)) {
+            dimensionStrategy.setUseAppMarket(useAppMarket);
+        }
+        String appStore = strategyJson.getString("appStore"); // 应用商店列表
+        if (!Check.isNull(appStore)) {
+            dimensionStrategy.setAppStore(appStore);
+        }
+        Integer unitType = strategyJson.getInteger("unitType"); // 创意制作方式
+        if (!Check.isNull(unitType)) {
+            dimensionStrategy.setUnitType(unitType);
+        }
+        Integer showMode = strategyJson.getInteger("showMode"); // 创意展现方式
+        if (!Check.isNull(showMode)) {
+            dimensionStrategy.setShowMode(showMode);
+        }
+        Integer speed = strategyJson.getInteger("speed"); // 投放方式
+        if (!Check.isNull(speed)) {
+            dimensionStrategy.setSpeed(speed);
+        }
+        if (Check.isNull(id)) {
+            int insert = dimensionStrategyMapper.insert(dimensionStrategy);
+            if (insert > 0) {
+                log.info("素材多维度策略信息入库完成,id:{}", dimensionStrategy.getId());
+            }
+        } else {
+            int i = dimensionStrategyMapper.updateById(dimensionStrategy);
+            if (i > 0) {
+                log.info("素材多维度策略信息修改完成,id:{}", dimensionStrategy.getId());
+            }
+        }
+        JSONArray appInfoArray = strategyJson.getJSONArray("appInfoArray");
+        JSONArray creativeArray = strategyJson.getJSONArray("creativeArray");
+        JSONArray crowdArray = strategyJson.getJSONArray("crowdArray");
+        if (!Check.isNull(appInfoArray)) {
+            dimensionAccountService.insertAccountIds(dimensionStrategy.getId(), appInfoArray, creativeArray, crowdArray);
+        }
+    }
+
+
+    @Override
+    public JSONObject create(Long id, JSONArray materialArray) {
+        JSONObject returnJson = new JSONObject();
+        try {
+            KuaiShouDimensionStrategy strategy = this.getById(id);
+            if (Check.isNull(strategy)) {
+                throw new Exception("未获取到策略信息");
+            }
+
+            JSONArray dimensionVariableList = dimensionVariableService.getDimensionVariableList(id); // 获取变量排列组合
+            if (Check.isNull(dimensionVariableList)) {
+                throw new Exception("变量排列组合信息为空");
+            }
+            List<KuaiShouDimensionAccount> accountList = dimensionAccountService.getListByStrategyId(id, 0); // 获取在投账户列表
+            if (Check.isNull(accountList)) {
+                throw new Exception("账户关联账户列表信息为空");
+            }
+
+            String unitName = strategy.getUnitName(); // 组名称
+            Long unitDayBudget = strategy.getUnitDayBudget(); // 组预算
+            Integer useAppMarket = strategy.getUseAppMarket(); // 优先从应用商店下载
+            JSONArray appStore = JSONArray.parseArray(strategy.getAppStore()); //  应用商店
+
+            Integer network = strategy.getNetwork(); // 网络环境
+            JSONArray fansStar = JSONArray.parseArray(strategy.getFansStar()); // 网红粉丝
+            Integer filterConvertedLevel = strategy.getFilterConvertedLevel();  // 过滤已转化
+            JSONArray deviceBrand = JSONArray.parseArray(strategy.getDeviceBrand()); // 设备品牌
+            JSONArray devicePrice = JSONArray.parseArray(strategy.getDevicePrice()); // 设备价格
+            Integer bidType = strategy.getBidType(); // 优化目标类型
+            Integer ocpxActionType = strategy.getOcpxActionType(); // 转化目标
+            Integer deepConversionType = strategy.getDeepConversionType(); // 深度转化目标
+            Long bid = strategy.getBid(); // 出价
+            String cpaBid = strategy.getCpaBid(); // 转化出价
+            Long deepConversionBid = strategy.getDeepConversionBid(); // 深度转化出价
+            JSONArray sceneId = JSONArray.parseArray(strategy.getSceneId()); // 资源位置
+            JSONArray actionBarText = JSONArray.parseArray(strategy.getActionBarText()); // 行动号召按钮
+            JSONArray description = JSONArray.parseArray(strategy.getDescription()); // 广告语
+            Integer unitType = strategy.getUnitType(); // 创意制作方式
+            Integer speed = strategy.getSpeed(); // 创意制作方式
+            Integer showMode = strategy.getShowMode(); // 创意制作方式
+            Integer accountIndex = 0;
+            Integer actionBarTextIndex = 0;
+            Integer descriptionIndex = 0;
+            int accountMaxIndex = accountList.size() - 1;
+            int actionBarTextMaxIndex = actionBarText.size() - 1;
+            int descriptionMaxIndex = description.size() - 1;
+            List<List<Object>> materials = Lists.partition(materialArray, strategy.getMaterialNum()); // 将素材切割
+            for (int i = 0; i < materials.size(); i++) {
+                JSONArray videoArray = JSONArray.parseArray(materials.get(i).toString());
+                for (int j = 0; j < dimensionVariableList.size(); j++) {
+                    JSONObject variableJson = dimensionVariableList.getJSONObject(j);
+                    if (accountIndex > accountMaxIndex) {
+                        accountIndex = 0;
+                    }
+                    KuaiShouDimensionAccount account = getAccountInfo(accountIndex, accountList);
+                    accountIndex++;
+                    if (Check.isNull(account)) {
+                        continue;
+                    }
+                    Long campaignId = getCampaignId(account.getAccountId(), account, strategy);
+                    if (Check.isNull(campaignId)) {
+                        continue;
+                    }
+                    String countKey = campaign_relation_unit + campaignId;
+                    Object o = redisUtil.get(countKey);
+                    Integer count = 0;
+                    if (!Check.isNull(o)) {
+                        Integer createCount = Integer.valueOf(o.toString());
+                        if (createCount >= strategy.getUnitNum()) {
+                            String inUseKey = in_use_key + account.getAccountId();
+                            redisUtil.del(inUseKey);
+                            campaignId = getCampaignId(account.getAccountId(), account, strategy);
+                            if (Check.isNull(campaignId)) {
+                                continue;
+                            }
+                            countKey = campaign_relation_unit + campaignId;
+                        } else {
+                            count = createCount;
+                        }
+                    }
+                    KuaiShouDimensionUnit unit = new KuaiShouDimensionUnit();
+                    String uuid = getUuid();
+                    unit.setId(uuid);
+                    unit.setStrategyId(id);
+                    unit.setAccountId(account.getAccountId());
+                    unit.setCampaignId(campaignId);
+                    String name = getName(unitName, account, strategy);
+                    unit.setUnitName(name + "_" + count);
+                    unit.setUnitDayBudget(unitDayBudget);
+                    unit.setUseAppMarket(useAppMarket);
+                    if (useAppMarket == 1) {
+                        if (!Check.isNull(appStore)) {
+                            unit.setAppStore(appStore.toJSONString());
+                        }
+                    }
+                    unit.setAppId(account.getAppId());
+                    if (account.getUseSchemaUri() == 0) {
+                        unit.setSchemaUri(account.getSchemaUri());
+                    }
+                    unit.setShowMode(showMode);
+                    unit.setSpeed(speed);
+                    if (!Check.isNull(JSONArray.parseArray(account.getPopulation()))) {
+                        unit.setPopulation(account.getPopulation());
+                    }
+                    if (!Check.isNull(JSONArray.parseArray(account.getExcludePopulation()))) {
+                        unit.setExcludePopulation(account.getExcludePopulation());
+                    }
+                    if (!Check.isNull(JSONArray.parseArray(account.getPaidAudience()))) {
+                        unit.setPaidAudience(account.getPaidAudience());
+                    }
+                    if (!Check.isNull(network)) {
+                        unit.setNetwork(network);
+                    }
+                    if (!Check.isNull(fansStar)) {
+                        unit.setFansStar(fansStar.toJSONString());
+                    }
+                    unit.setFilterConvertedLevel(filterConvertedLevel);
+                    if (!Check.isNull(deviceBrand)) {
+                        unit.setDeviceBrand(deviceBrand.toJSONString());
+                    }
+                    if (!Check.isNull(devicePrice)) {
+                        unit.setDevicePrice(devicePrice.toJSONString());
+                    }
+                    unit.setUnitType(unitType);
+                    if (!Check.isNull(bidType)) {
+                        unit.setBidType(bidType);
+                    }
+                    if (!Check.isNull(ocpxActionType)) {
+                        unit.setOcpxActionType(ocpxActionType);
+                    }
+                    if (!Check.isNull(deepConversionType)) {
+                        unit.setDeepConversionType(deepConversionType);
+                    }
+                    if (!Check.isNull(bid)) {
+                        unit.setBid(bid);
+                    }
+                    if (!Check.isNull(cpaBid)) {
+                        unit.setCpaBid(getBidByString(cpaBid));
+                    }
+                    if (!Check.isNull(deepConversionBid)) {
+                        unit.setDeepConversionBid(deepConversionBid);
+                    }
+                    unit.setSceneId(sceneId.toJSONString());
+
+
+                    // 年龄
+                    String ages_range = variableJson.getString("ages_range");
+                    if (!Check.isNull(ages_range)) {
+                        if (!"unlimited".equals(ages_range)) {
+                            JSONArray ageArray = getAgeArray(ages_range);
+                            unit.setAgesRange(ageArray.toJSONString());
+                            unit.setAgeGroupName(getAgeName(ages_range));
+                        } else {
+                            unit.setAgeGroupName("不限");
+                        }
+                    } else {
+                        unit.setAgeGroupName("不限");
+
+                    }
+                    // 性别
+                    String gender = variableJson.getString("gender");
+                    if (!Check.isNull(gender)) {
+                        if (!"unlimited".equals(gender)) {
+                            unit.setGender(Integer.valueOf(gender));
+                        }
+                    }
+
+                    // 时段
+                    String schedule_time = variableJson.getString("schedule_time");
+                    if (!Check.isNull(schedule_time)) {
+                        if (!"unlimited".equals(schedule_time)) {
+                            unit.setScheduleTime(schedule_time);
+                        }
+                    }
+
+                    //  应用名称-行为定向
+                    JSONArray app_ids = variableJson.getJSONArray("app_ids");
+                    if (!Check.isNull(app_ids)) {
+                        String appId = app_ids.getString(0);
+                        if (!"unlimited".equals(appId)) {
+                            unit.setAppIds(app_ids.toJSONString());
+                        }
+                    }
+                    // 行为意向-系统优选
+                    String intention_target = variableJson.getString("intention_target");
+                    if (!Check.isNull(intention_target)) {
+                        if (!"unlimited".equals(intention_target)) {
+                            if (intention_target.equals("1")) {
+                                unit.setIntentionTarget(true);
+                            } else {
+                                unit.setIntentionTarget(false);
+                            }
+                        } else {
+                            unit.setIntentionTarget(false);
+                        }
+                    } else {
+                        unit.setIntentionTarget(false);
+                    }
+                    // 地域
+                    String region = variableJson.getString("region");
+                    if (!Check.isNull(region)) {
+                        if (!"unlimited".equals(region)) {
+                            JSONArray regionArray = getRegion(region);
+                            unit.setRegion(regionArray.toJSONString());
+                            unit.setRegionGroupName(getRegionName(region));
+                        } else {
+                            unit.setRegionGroupName("不限");
+                        }
+                    } else {
+                        unit.setRegionGroupName("不限");
+                    }
+
+                    Integer intelli_extend = variableJson.getInteger("intelli_extend");
+                    if (!Check.isNull(intelli_extend)) {
+                        if (intelli_extend == 0) {
+                            unit.setIsOpen(0);
+                        } else if (intelli_extend == 1) {
+                            unit.setIsOpen(1);
+                            if (!Check.isNull(ages_range)) {
+                                if (!"unlimited".equals(ages_range)) {
+                                    unit.setNoAgeBreak(1);
+                                }
+                            }
+                            if (!Check.isNull(gender)) {
+                                if (!"unlimited".equals(gender)) {
+                                    unit.setNoGenderBreak(1);
+                                }
+                            }
+                            if (!Check.isNull(region)) {
+                                if (!"unlimited".equals(region)) {
+                                    unit.setNoAreaBreak(1);
+                                }
+                            }
+
+                        }
+                    }
+                    redisUtil.set(countKey, count + 1);
+                    addUnit(unit); // 组数据入库
+
+                    // 平均获取行动号召按钮
+                    if (actionBarTextIndex > actionBarTextMaxIndex) {
+                        actionBarTextIndex = 0;
+                    }
+                    String actionBarTextStr = getStringByIndex(actionBarTextIndex, actionBarText);
+                    // 平均获取广告语
+                    if (descriptionIndex > descriptionMaxIndex) {
+                        descriptionIndex = 0;
+                    }
+                    String descriptionStr = getStringByIndex(descriptionIndex, description);
+                    // 创意数据入库
+                    addCreative(uuid, videoArray, campaignId, account, actionBarTextStr, descriptionStr);
+                }
+            }
+            returnJson.put("code", 0);
+            returnJson.put("message", "创建成功");
+        } catch (Exception e) {
+            e.printStackTrace();
+            returnJson.put("code", -1);
+            returnJson.put("message", "创建失败");
+        }
+        return returnJson;
+    }
+
+    /**
+     * 获取年龄配置
+     *
+     * @param mapId
+     * @return
+     */
+    private JSONArray getAgeArray(String mapId) {
+        if (Check.isNullMap(ageMap)) {
+            ageMap = dimensionAgeConfigService.getAgeMap();
+        }
+        return ageMap.get(mapId);
+
+
+    }
+
+    /**
+     * 获取年龄组名称
+     *
+     * @param mapId
+     * @return
+     */
+    private String getAgeName(String mapId) {
+        if (Check.isNullMap(ageNameMap)) {
+            ageNameMap = dimensionAgeConfigService.getAgeNameMap();
+        }
+        return ageNameMap.get(mapId);
+    }
+
+    /**
+     * 根据下标获取信息
+     *
+     * @param index
+     * @param jsonArray
+     * @return
+     */
+    private String getStringByIndex(Integer index, JSONArray jsonArray) {
+        return jsonArray.getString(index);
+    }
+
+
+    /**
+     * 多线程添加创意信息
+     *
+     * @param videoArray
+     * @param campaignId
+     * @param account
+     * @param actionBarText
+     * @param description
+     */
+    private void addCreative(String unitTableId, JSONArray videoArray, Long campaignId, KuaiShouDimensionAccount account, String actionBarText, String description) {
+        addCreativeService.submit(new Runnable() {
+            @Override
+            public void run() {
+                List<KuaiShouDimensionCreative> addList = new ArrayList<>();
+                for (int i = 0; i < videoArray.size(); i++) {
+                    Long photoId = videoArray.getLong(i);
+                    if (Check.isNull(photoId)) {
+                        continue;
+                    }
+                    KuaiShouVideoGet videoGet = videoGetService.getVideoByPhotoId(photoId);
+                    if (Check.isNull(videoGet)) {
+                        continue;
+                    }
+
+                    KuaiShouDimensionCreative creative = new KuaiShouDimensionCreative();
+                    creative.setUnitTableId(unitTableId);
+                    creative.setStrategyId(account.getStrategyId());
+                    creative.setAccountId(account.getAccountId());
+                    creative.setCampaignId(campaignId);
+                    creative.setCreativeName("创意_" + i);
+                    creative.setPhotoId(photoId);
+                    creative.setCreativeMaterialType(videoGet.getMaterialType());
+                    creative.setActionBarText(actionBarText);
+                    creative.setDescription(description);
+                    if (!Check.isNull(account.getClickTrackUrl())) {
+                        creative.setClickTrackUrl(account.getClickTrackUrl());
+                    }
+                    if (!Check.isNull(account.getActionbarClickUrl())) {
+                        creative.setActionbarClickUrl(account.getActionbarClickUrl());
+                    }
+                    if (!Check.isNull(account.getCreativeCategory())) {
+                        creative.setCreativeCategory(account.getCreativeCategory());
+                    }
+                    if (!Check.isNull(account.getCreativeTag())) {
+                        creative.setCreativeTag(account.getCreativeTag());
+                    }
+                    addList.add(creative);
+                }
+                if (!Check.isNull(addList)) {
+                    dimensionCreativeService.addBatch(addList);
+                }
+            }
+        });
+
+
+    }
+
+
+    /**
+     * 多线程添加组信息
+     *
+     * @param unit
+     */
+    private void addUnit(KuaiShouDimensionUnit unit) {
+        addUnitService.submit(new Runnable() {
+            @Override
+            public void run() {
+                dimensionUnitService.save(unit);
+            }
+        });
+
+
+    }
+
+
+    /**
+     * 获取地域信息
+     *
+     * @param mapId
+     * @return
+     */
+    private JSONArray getRegion(String mapId) {
+        if (Check.isNullMap(regionMap)) {
+            regionMap = dimensionRegionDetailService.getRegionList();
+        }
+        return regionMap.get(mapId);
+    }
+
+    /**
+     * 获取地域组名称
+     *
+     * @param mapId
+     * @return
+     */
+    private String getRegionName(String mapId) {
+        if (Check.isNullMap(regionNameMap)) {
+            regionNameMap = dimensionRegionDetailService.getRegionNameList();
+        }
+        return regionNameMap.get(mapId);
+    }
+
+    /**
+     * 获取随机、区间出价
+     *
+     * @param cpaBid
+     * @return
+     */
+    private Long getBidByString(String cpaBid) {
+        if (Check.isNull(cpaBid)) {
+            return null;
+        }
+        String bidString = null;
+        if (cpaBid.contains("/")) { // 阶梯出价
+            String[] split = cpaBid.split("/");
+            int random = new Random().nextInt(split.length);
+            bidString = split[random];
+
+        } else if (cpaBid.contains("-")) { // 随机出价
+            String[] split = cpaBid.split("-");
+            Double min = Double.valueOf(split[0]) / 1000;
+            Double max = Double.valueOf(split[1]) / 1000;
+            Double randomNumber = new BigDecimal(min + Math.random() * (max - min)).setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue();
+            bidString = String.valueOf(new Double(randomNumber * 1000).longValue());
+        } else {
+            bidString = cpaBid;
+        }
+        return Long.valueOf(bidString);
+    }
+
+
+    /**
+     * 获取主键uuId
+     *
+     * @return
+     */
+    private static String getUuid() {
+        String uuid = UUID.randomUUID().toString().replace("-", "");
+        return uuid;
+
+    }
+
+    /**
+     * 获取计划
+     *
+     * @param accountId
+     * @param account
+     * @param strategy
+     * @return
+     */
+    private Long getCampaignId(Long accountId, KuaiShouDimensionAccount account, KuaiShouDimensionStrategy strategy) {
+        String key = in_use_key + accountId;
+        Object o = redisUtil.get(key);
+        if (!Check.isNull(o)) {
+            return Long.valueOf(o.toString());
+        }
+        String createCampaignCountKey = account_count_key + accountId;
+        Object countObject = redisUtil.get(createCampaignCountKey);
+        Integer count = 0;
+        if (Check.isNull(countObject)) {
+            redisUtil.set(createCampaignCountKey, count);
+        } else {
+            count = Integer.valueOf(countObject.toString()) + 1;
+            redisUtil.set(createCampaignCountKey, count);
+        }
+        CtopOauthToken token = oauthTokenService.getTokenByAccountId(accountId);
+        JSONObject campaignParams = new JSONObject();
+        campaignParams.put("advertiser_id", token.getAccountId());
+
+        String campaignName = strategy.getCampaignName();
+        String name = getName(campaignName, account, strategy) + "_" + count;
+        campaignParams.put("campaign_name", name);
+        campaignParams.put("type", strategy.getCampaignType());
+        if (null != strategy.getCampaignDayBudget() && strategy.getCampaignDayBudget() != 0) {
+            campaignParams.put("day_budget", strategy.getCampaignDayBudget());
+        }
+        Map<String, Object> campaignCreateResult = kuaishouInterfaceService.campaignCreate(token.getAccessToken(), token.getAccountId(), campaignParams);
+        Integer code = (Integer) campaignCreateResult.get("code");
+        String message = (String) campaignCreateResult.get("message");
+        if (code != 0) {
+            log.info("计划创建失败,accountId:{}message:{}", accountId, message);
+            return null;
+        }
+        Long campaignId = (Long) campaignCreateResult.get("campaignId");
+        redisUtil.set(key, campaignId);
+        KuaiShouDimensionCampaign campaign = new KuaiShouDimensionCampaign();
+        campaign.setAccountId(accountId);
+        campaign.setStrategyId(strategy.getId());
+        campaign.setCampaignId(campaignId);
+        campaign.setCampaignType(strategy.getCampaignType());
+        campaign.setCampaignName(name);
+        campaign.setDayBudget(strategy.getCampaignDayBudget());
+        boolean save = dimensionCampaignService.save(campaign);
+        if (save) {
+            log.info("素材多维度计划入库成功,策略id:{},账户id:{},计划id:{}", strategy.getId(), accountId, campaignId);
+        }
+
+        return campaignId;
+    }
+
+    /**
+     * 获取账户配置
+     *
+     * @param index
+     * @param accountList
+     * @return
+     */
+    private KuaiShouDimensionAccount getAccountInfo(Integer index, List<KuaiShouDimensionAccount> accountList) {
+        return accountList.get(index);
+    }
+
+    private String getName(String name, KuaiShouDimensionAccount account, KuaiShouDimensionStrategy strategy) {
+        if (name.contains("{{应用包名}}") || name.contains("{{应用标记}}")) {
+            KuaiShouAppList getAppInfo = appListService.getAppInfo(account.getAccountId(), account.getAppId());
+            if (!Check.isNull(getAppInfo)) {
+                name = name.replace("{{应用包名}}", getAppInfo.getAppName());
+                name = name.replace("{{应用标记}}", getAppInfo.getAppVersion());
+            } else {
+                name = name.replace("{{应用包名}}", "");
+                name = name.replace("{{应用标记}}", "");
+            }
+        }
+        if (name.contains("{{创意制作方式}}")) {
+            if (strategy.getUnitType() == 4) {
+                name = name.replace("{{创意制作方式}}", "自定义");
+            } else if (strategy.getUnitType() == 7) {
+                name = name.replace("{{创意制作方式}}", "程序化");
+            }
+        }
+        if (name.contains("{{广告位置}}")) {
+            String adsence = getAdSenceByParams(strategy.getSceneId());
+            name = name.replace("{{广告位置}}", adsence);
+        }
+        if (name.contains("{{日期}}")) {
+            Date date = new Date();
+            String nowDate = DateUtils.formatDate(date, "yy-MMdd");
+            name = name.replace("{{日期}}", nowDate);
+        }
+        if (name.contains("{{时分}}")) {
+            Date date = new Date();
+            String nowDate = DateUtils.formatDate(date, "HH:mm");
+            name = name.replace("{{时分}}", nowDate);
+        }
+        if (name.endsWith("-")) {
+            name = name.substring(0, name.length() - 1);
+        }
+        return name;
+    }
+
+    private String getAdSenceByParams(String sceneIdString) {
+        String adsence = "";
+        if (null == sceneIdString || "".equals(sceneIdString)) {
+            return adsence;
+        }
+        JSONArray sceneIdArray = JSON.parseArray(sceneIdString);
+        if (null == sceneIdArray || sceneIdArray.isEmpty()) {
+            return adsence;
+        }
+        for (int i = 0; i < sceneIdArray.size(); i++) {
+            adsence += KuaishouCreativeAdsenceTypeEnum.getNameByType(sceneIdArray.getInteger(i)) + "-";
+        }
+        return adsence.substring(0, adsence.length() - 1);
+    }
+}

+ 296 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/service/impl/KuaiShouDimensionUnitServiceImpl.java

@@ -0,0 +1,296 @@
+package cn.com.ctop.kuaishou.modules.dimension.service.impl;
+
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
+import cn.com.ctop.kuaishou.modules.dimension.entity.KuaiShouDimensionUnit;
+import cn.com.ctop.kuaishou.modules.dimension.mapper.KuaiShouDimensionUnitMapper;
+import cn.com.ctop.kuaishou.modules.dimension.service.IKuaiShouDimensionCreativeService;
+import cn.com.ctop.kuaishou.modules.dimension.service.IKuaiShouDimensionUnitService;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.util.DateUtils;
+import org.jeecg.common.util.RedisUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 多维度测试组列表
+ *
+ * @author jeecg-boot
+ * 2021-07-22
+ * @version V1.0
+ */
+@Slf4j
+@Service
+public class KuaiShouDimensionUnitServiceImpl extends ServiceImpl<KuaiShouDimensionUnitMapper, KuaiShouDimensionUnit> implements IKuaiShouDimensionUnitService {
+    @Autowired
+    private KuaiShouDimensionUnitMapper dimensionUnitMapper;
+    @Autowired
+    private IKuaishouInterfaceService kuaishouInterfaceService;
+    @Autowired
+    private IKuaiShouDimensionCreativeService dimensionCreativeService;
+    @Autowired
+    private RedisUtil redisUtil;
+    @Autowired
+    private IKuaiShouDimensionUnitService dimensionUnitService;
+
+    /**
+     * 创建组
+     *
+     * @param strategyId
+     * @param accountId
+     */
+    @Override
+    public void createUnit(Long strategyId, Long accountId, String accessToken) {
+        QueryWrapper<KuaiShouDimensionUnit> unitQueryWrapper = new QueryWrapper<>();
+        unitQueryWrapper.eq("strategy_id", strategyId);
+        unitQueryWrapper.eq("account_id", accountId);
+        unitQueryWrapper.eq("submit_status", 1);
+        unitQueryWrapper.orderByAsc("create_time");
+        unitQueryWrapper.last("limit 10");
+        List<KuaiShouDimensionUnit> kuaiShouDimensionUnits = dimensionUnitMapper.selectList(unitQueryWrapper);
+        if (Check.isNull(kuaiShouDimensionUnits)) {
+            return;
+        }
+        for (KuaiShouDimensionUnit unit : kuaiShouDimensionUnits) {
+            Boolean trueOrFalse = dimensionUnitService.getCreateOverrun(accountId);
+            if (trueOrFalse) {
+                log.error("该账户今日创建已超限,策略id:{},账户id:{}", strategyId, accountId);
+                return;
+            }
+
+            KuaiShouDimensionUnit updateDimensionUnit = new KuaiShouDimensionUnit();
+            updateDimensionUnit.setId(unit.getId());
+            updateDimensionUnit.setSubmitStatus(2);
+            updateDimensionUnit.setCreateDescribe("创建中");
+            dimensionUnitMapper.updateById(updateDimensionUnit);
+
+            JSONObject createUnitJson = new JSONObject();
+            createUnitJson.put("scene_id", JSONArray.parseArray(unit.getSceneId())); //资源位置
+            createUnitJson.put("campaign_id", unit.getCampaignId());
+            createUnitJson.put("unit_name", unit.getUnitName());
+            if (!Check.isNull(unit.getBidType())) {
+                createUnitJson.put("bid_type", unit.getBidType()); // 优化目标类型
+            }
+            if (!Check.isNull(unit.getUseAppMarket())) {
+                createUnitJson.put("use_app_market", unit.getUseAppMarket()); //优先从系统应用商店下载
+            }
+            if (!Check.isNull(unit.getAppStore())) {
+                createUnitJson.put("app_store", JSONArray.parseArray(unit.getAppStore())); //应用商店列表
+            }
+            if (!Check.isNull(unit.getBid())) {
+                createUnitJson.put("bid", unit.getBid()); //出价
+            }
+            if (!Check.isNull(unit.getCpaBid())) {
+                createUnitJson.put("cpa_bid", unit.getCpaBid()); //出价
+            }
+            if (!Check.isNull(unit.getOcpxActionType())) {
+                createUnitJson.put("ocpx_action_type", unit.getOcpxActionType()); //优化目标
+            }
+            if (!Check.isNull(unit.getDeepConversionType())) {
+                createUnitJson.put("deep_conversion_type", unit.getDeepConversionType()); //深度转化目标
+            }
+            if (!Check.isNull(unit.getDeepConversionBid())) {
+                createUnitJson.put("deep_conversion_bid", unit.getDeepConversionBid()); //深度转化目标出价
+            }
+            if (!Check.isNull(unit.getUnitType())) {
+                createUnitJson.put("unit_type", unit.getUnitType()); //创意制作方式
+            }
+            createUnitJson.put("begin_time", DateUtils.getNowDate("yyyy-MM-dd")); //投放开始时间
+            if (!Check.isNull(unit.getScheduleTime())) {
+                createUnitJson.put("schedule_time", unit.getScheduleTime()); //投放时间段
+            }
+            if (!Check.isNull(unit.getUnitDayBudget())) {
+                createUnitJson.put("day_budget", unit.getUnitDayBudget()); //单日预算金额
+            }
+            if (!Check.isNull(unit.getSchemaUri())) {
+                createUnitJson.put("schema_uri", unit.getSchemaUri()); // 吊起链接
+            }
+            if (!Check.isNull(unit.getAppId())) {
+                createUnitJson.put("app_id", unit.getAppId()); // 应用ID
+            }
+            if (!Check.isNull(unit.getShowMode())) {
+                createUnitJson.put("show_mode", unit.getShowMode()); // 创意展现方式
+            }
+            if (!Check.isNull(unit.getSpeed())) {
+                createUnitJson.put("speed", unit.getSpeed()); // 投放方式
+            }
+            if (!Check.isNull(unit.getIntentionTarget())) {
+                if (unit.getIntentionTarget()) {
+                    createUnitJson.put("intention_target", unit.getIntentionTarget()); // 行为意向-系统优选
+                }
+            }
+            JSONObject targetJson = getTarget(unit);
+            createUnitJson.put("target", targetJson);
+
+            Map<String, Object> returnUnitMap = kuaishouInterfaceService.adUnitCreate(accessToken, accountId, createUnitJson, 1);
+            Integer unitCode = (Integer) returnUnitMap.get("code");
+            if (unitCode == 0) {
+                updateDimensionUnit.setSubmitStatus(3);
+                updateDimensionUnit.setCreateDescribe("创建成功");
+                Long unitId = (Long) returnUnitMap.get("unitId");
+                updateDimensionUnit.setUnitId(unitId);
+                dimensionUnitMapper.updateById(updateDimensionUnit);
+                dimensionCreativeService.createCreative(accountId, accessToken, unit.getId(), unitId);
+            } else {
+                String unitMessage = (String) returnUnitMap.get("message");
+                if ("/rest/openapi/v2/ad_unit/create调用已超日限,次日可恢复调用".equals(unitMessage)) {
+                    updateDimensionUnit.setSubmitStatus(1);
+                    updateDimensionUnit.setCreateDescribe("当日组创建超限");
+                    dimensionUnitMapper.updateById(updateDimensionUnit);
+                    return;
+                } else {
+                    updateDimensionUnit.setSubmitStatus(4);
+                    updateDimensionUnit.setCreateDescribe(unitMessage);
+                    dimensionUnitMapper.updateById(updateDimensionUnit);
+                }
+            }
+        }
+
+
+    }
+
+
+    private JSONObject getTarget(KuaiShouDimensionUnit unit) {
+        JSONObject target = new JSONObject();
+        if (!Check.isNull(unit.getRegion())) {
+            target.put("region", JSONArray.parseArray(unit.getRegion()));
+        }
+
+        if (!Check.isNull(unit.getAgesRange())) {
+            target.put("ages_range", JSONArray.parseArray(unit.getAgesRange()));
+        }
+
+        if (!Check.isNull(unit.getGender())) {
+            target.put("gender", unit.getGender());
+        }
+
+        if (!Check.isNull(unit.getNetwork())) {
+            target.put("network", unit.getNetwork());
+        }
+
+        if (!Check.isNull(unit.getDeviceBrand())) {
+            target.put("device_brand", JSONArray.parseArray(unit.getDeviceBrand()));
+        }
+
+        if (!Check.isNull(unit.getDevicePrice())) {
+            target.put("device_price", JSONArray.parseArray(unit.getDevicePrice()));
+        }
+
+        if (!Check.isNull(unit.getAppIds())) {
+            target.put("app_ids", JSONArray.parseArray(unit.getAppIds()));
+        }
+
+        if (!Check.isNull(unit.getPopulation())) {
+            target.put("population", JSONArray.parseArray(unit.getPopulation()));
+        }
+
+        if (!Check.isNull(unit.getExcludePopulation())) {
+            target.put("exclude_population", JSONArray.parseArray(unit.getExcludePopulation()));
+        }
+
+        if (!Check.isNull(unit.getPaidAudience())) {
+            target.put("paid_audience", JSONArray.parseArray(unit.getPaidAudience()));
+        }
+
+        if (!Check.isNull(unit.getFilterConvertedLevel())) {
+            target.put("filter_converted_level", unit.getFilterConvertedLevel());
+        }
+
+        if (!Check.isNull(unit.getIsOpen())) {
+            if (unit.getIsOpen() == 1) {
+                JSONObject intelli_extend = new JSONObject();
+                intelli_extend.put("is_open", unit.getIsOpen());
+                if (!Check.isNull(unit.getNoAgeBreak())) {
+                    if (unit.getNoAgeBreak() == 1) {
+                        intelli_extend.put("no_age_break", unit.getNoAgeBreak());
+                    }
+                }
+                if (!Check.isNull(unit.getNoGenderBreak())) {
+                    if (unit.getNoGenderBreak() == 1) {
+                        intelli_extend.put("no_gender_break", unit.getNoGenderBreak());
+                    }
+                }
+                if (!Check.isNull(unit.getNoAreaBreak())) {
+                    if (unit.getNoAreaBreak() == 1) {
+                        intelli_extend.put("no_area_break", unit.getNoAreaBreak());
+                    }
+                }
+                target.put("intelli_extend", intelli_extend);
+            }
+        }
+        return target;
+    }
+
+    @Override
+    public Boolean getCreateOverrun(Long accountId) {
+        String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
+        String creativeKey = accountId + "_" + nowDate + "creative_create_overrun";
+        Object creative = redisUtil.get(creativeKey);
+
+        String unitKey = accountId + "_" + nowDate + "unit_create_overrun";
+        Object unit = redisUtil.get(unitKey);
+
+        if (Check.isNull(creative) && Check.isNull(unit)) {
+            return false;
+        }
+        if (!Check.isNull(creative)) {
+            Integer creativeOverrun = (Integer) creative;
+            if (creativeOverrun == 1) {
+                return true;
+            }
+        }
+        if (!Check.isNull(unit)) {
+            Integer unitOverrun = (Integer) unit;
+            if (unitOverrun == 1) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    @Override
+    public List<JSONObject> getCampaignCount(Long accountId, Long strategyId) {
+        return dimensionUnitMapper.getCampaignCount(accountId, strategyId);
+    }
+
+    @Override
+    public Integer getUnitCount(Long accountId, Long strategyId) {
+        return dimensionUnitMapper.getUnitCount(accountId, strategyId);
+    }
+
+    @Override
+    public List<KuaiShouDimensionUnit> getUnitListBy(Long strategyId, Long accountId, Long campaignId) {
+
+        QueryWrapper<KuaiShouDimensionUnit> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("strategy_id", strategyId);
+        queryWrapper.eq("account_id", accountId);
+        queryWrapper.eq("campaign_id", campaignId);
+        queryWrapper.eq("submit_status", 0);
+        queryWrapper.orderByDesc("unit_name");
+        return dimensionUnitMapper.selectList(queryWrapper);
+    }
+
+    /**
+     * 批量修改状态
+     *
+     * @param submitStatus
+     * @param ids
+     */
+    @Override
+    public void editBatch(Integer submitStatus, JSONArray ids) {
+        dimensionUnitMapper.editBatch(submitStatus, ids);
+    }
+
+    @Override
+    public Integer getUnitCountByStrategyId(Long strategyId) {
+        return dimensionUnitMapper.getUnitCountByStrategyId(strategyId);
+    }
+
+}

+ 188 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/service/impl/KuaiShouDimensionVariableServiceImpl.java

@@ -0,0 +1,188 @@
+package cn.com.ctop.kuaishou.modules.dimension.service.impl;
+
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.kuaishou.modules.dimension.entity.KuaiShouDimensionVariable;
+import cn.com.ctop.kuaishou.modules.dimension.mapper.KuaiShouDimensionVariableMapper;
+import cn.com.ctop.kuaishou.modules.dimension.service.IKuaiShouDimensionVariableService;
+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 org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 多维度测试变量配置
+ *
+ * @author jeecg-boot
+ * 2021-07-20
+ * @version V1.0
+ */
+@Service
+public class KuaiShouDimensionVariableServiceImpl extends ServiceImpl<KuaiShouDimensionVariableMapper, KuaiShouDimensionVariable> implements IKuaiShouDimensionVariableService {
+    @Autowired
+    private KuaiShouDimensionVariableMapper dimensionVariableMapper;
+
+    @Override
+    public JSONArray getDimensionVariableList(Long strategyId) {
+        QueryWrapper<KuaiShouDimensionVariable> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("strategy_id", strategyId);
+        KuaiShouDimensionVariable dimensionVariable = this.getOne(queryWrapper);
+        if (Check.isNull(dimensionVariable)) {
+            return null;
+        }
+        List<List<JSONObject>> inputList = new ArrayList<>();
+        //  地域数据组装
+        String region = dimensionVariable.getRegion();
+        JSONArray regionArray = JSONArray.parseArray(region);
+        if (!Check.isNull(regionArray)) {
+            List<JSONObject> regionList = new ArrayList<>();
+            for (int i = 0; i < regionArray.size(); i++) {
+                JSONObject regionJson = new JSONObject();
+                regionJson.put("region", regionArray.getString(i));
+                regionList.add(regionJson);
+            }
+            inputList.add(regionList);
+        }
+        // 年龄数据组装
+        String agesRange = dimensionVariable.getAgesRange();
+        JSONArray agesRangeArray = JSONArray.parseArray(agesRange);
+        if (!Check.isNull(agesRangeArray)) {
+            List<JSONObject> agesRangeList = new ArrayList<>();
+            for (int i = 0; i < agesRangeArray.size(); i++) {
+                JSONObject agesRangeJson = new JSONObject();
+                agesRangeJson.put("ages_range", agesRangeArray.getString(i));
+                agesRangeList.add(agesRangeJson);
+            }
+            inputList.add(agesRangeList);
+        }
+
+        // 性别数据组装
+        String gender = dimensionVariable.getGender();
+        JSONArray genderArray = JSONArray.parseArray(gender);
+        if (!Check.isNull(genderArray)) {
+            List<JSONObject> genderList = new ArrayList<>();
+            for (int i = 0; i < genderArray.size(); i++) {
+                JSONObject genderJson = new JSONObject();
+                genderJson.put("gender", genderArray.getString(i));
+                genderList.add(genderJson);
+            }
+            inputList.add(genderList);
+        }
+        // app行为
+        String appIds = dimensionVariable.getAppIds();
+        JSONArray appIdArray = JSONArray.parseArray(appIds);
+        if (!Check.isNull(appIdArray)) {
+            List<JSONObject> appIdList = new ArrayList<>();
+            for (int i = 0; i < appIdArray.size(); i++) {
+                JSONArray app_ids = appIdArray.getJSONArray(i);
+                if (Check.isNull(app_ids)) {
+                    continue;
+                }
+                JSONObject appIdJson = new JSONObject();
+                appIdJson.put("app_ids", app_ids);
+                appIdList.add(appIdJson);
+            }
+            inputList.add(appIdList);
+        }
+
+        // 投放时段
+        String scheduleTime = dimensionVariable.getScheduleTime();
+        JSONArray scheduleTimeArray = JSONArray.parseArray(scheduleTime);
+        if (!Check.isNull(scheduleTimeArray)) {
+            List<JSONObject> scheduleTimeList = new ArrayList<>();
+            for (int i = 0; i < scheduleTimeArray.size(); i++) {
+                JSONObject scheduleTimeJson = new JSONObject();
+                scheduleTimeJson.put("schedule_time", scheduleTimeArray.getString(i));
+                scheduleTimeList.add(scheduleTimeJson);
+            }
+            inputList.add(scheduleTimeList);
+        }
+
+        // 智能扩量
+        String intelliExtend = dimensionVariable.getIntelliExtend();
+        JSONArray intelliExtendArray = JSONArray.parseArray(intelliExtend);
+        if (!Check.isNull(intelliExtendArray)) {
+            List<JSONObject> intelliExtendList = new ArrayList<>();
+            for (int i = 0; i < intelliExtendArray.size(); i++) {
+                JSONObject intelliExtendJson = new JSONObject();
+                intelliExtendJson.put("intelli_extend", intelliExtendArray.getString(i));
+                intelliExtendList.add(intelliExtendJson);
+            }
+            inputList.add(intelliExtendList);
+        }
+
+
+        //  行为意向
+        String intentionTarget = dimensionVariable.getIntentionTarget();
+        JSONArray intentionTargetArray = JSONArray.parseArray(intentionTarget);
+        if (!Check.isNull(intentionTargetArray)) {
+            List<JSONObject> intelliExtendList = new ArrayList<>();
+            for (int i = 0; i < intentionTargetArray.size(); i++) {
+                JSONObject intentionTargetJson = new JSONObject();
+                intentionTargetJson.put("intention_target", intentionTargetArray.getString(i));
+                intelliExtendList.add(intentionTargetJson);
+            }
+            inputList.add(intelliExtendList);
+        }
+
+
+        JSONArray jsonArray = calculateCombination(inputList);
+        return jsonArray;
+    }
+
+    @Override
+    public void removeByStrategyId(String id) {
+        QueryWrapper<KuaiShouDimensionVariable> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("strategy_id", id);
+        dimensionVariableMapper.delete(queryWrapper);
+    }
+
+
+    public static JSONArray calculateCombination(List<List<JSONObject>> inputList) {
+        JSONArray array = new JSONArray();
+        List<Integer> combination = new ArrayList<Integer>();
+        int n = inputList.size();
+        for (int i = 0; i < n; i++) {
+            combination.add(0);
+        }
+        int i = 0;
+        boolean isContinue = false;
+        do {
+            JSONObject dataJson = new JSONObject();
+            //打印一次循环生成的组合
+            for (int j = 0; j < n; j++) {
+                JSONObject jsonObject = inputList.get(j).get(combination.get(j));
+                jsonObject.forEach((key, value) -> {
+                    dataJson.put(key, value);
+                });
+
+            }
+            array.add(dataJson);
+
+            i++;
+            combination.set(n - 1, i);
+            for (int j = n - 1; j >= 0; j--) {
+                if (combination.get(j) >= inputList.get(j).size()) {
+                    combination.set(j, 0);
+                    i = 0;
+                    if (j - 1 >= 0) {
+                        combination.set(j - 1, combination.get(j - 1) + 1);
+                    }
+                }
+            }
+            isContinue = false;
+            for (Integer integer : combination) {
+                if (integer != 0) {
+                    isContinue = true;
+                }
+            }
+        } while (isContinue);
+        return array;
+    }
+
+
+}

+ 3 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/EtlKuaishouReportAccountDailyMapper.java

@@ -2,6 +2,7 @@ package cn.com.ctop.kuaishou.modules.report.mapper;
 
 import cn.com.ctop.kuaishou.modules.report.entity.EtlKuaishouReportAccountDaily;
 import cn.com.ctop.kuaishou.modules.report.entity.EtlKuaishouReportAccountHourly;
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Param;
@@ -51,4 +52,6 @@ public interface EtlKuaishouReportAccountDailyMapper extends BaseMapper<EtlKuais
     int operatingStaffDataListTotal(JSONObject request);
 
     List<JSONObject> operatingStaffDataList(JSONObject request);
+
+    JSONObject getReportData(@Param("startDate") String startDate, @Param("endDate") String endDate,@Param("accountIds") JSONArray accountIds);
 }

+ 44 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/EtlKuaishouReportAccountDailyMapper.xml

@@ -691,5 +691,49 @@
         </if>
         ${sortType}
     </select>
+    <select id="getReportData" resultType="com.alibaba.fastjson.JSONObject">
+
+        select
+        sum(charge) as 'charge',
+        sum(photo_show) as 'photoShow',
+        sum(photo_click) as 'photoClick',
+        sum(aclick) as 'aclick',
+        sum(bclick) as 'bclick',
+        sum(activation) as 'activation',
+        ROUND(sum(charge) / sum(bclick),3) as 'bclickPrice',
+        (case when sum(aclick) != 0
+        then ROUND(sum(bclick) / sum(aclick) * 100 ,3)
+        else '_'
+        end
+        ) as 'bclickRate',
+        (case when sum(aclick) != 0
+        then ROUND(sum(charge) / sum(aclick) * 1000 ,3)
+        else '-'
+        end
+        ) as 'impression1kCost',
+        (case when sum(aclick) != 0
+        then ROUND(sum(play_3s_count) / sum(aclick) * 100 ,3)
+        else '-'
+        end
+        ) as 'play3sRate',
+        sum(event_register) 'eventRegister',
+        (CASE WHEN  SUM(event_register) != 0
+        THEN ROUND(sum(charge) / sum(event_register) ,3)
+        ELSE '-'
+        END
+        ) as 'eventRegisterPrice'
+
+        from ctop_etl_kuaishou_report_account_daily
+        where 1 = 1
+        <if test="accountIds !=null and accountIds.size() != 0">
+            and account_id in
+            <foreach item="item" index="index" collection="accountIds"
+                     open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
+        and stat_date &gt;= #{startDate}
+        and stat_date &lt;= #{endDate}
+    </select>
 
 </mapper>

+ 3 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IEtlKuaishouReportAccountDailyService.java

@@ -1,6 +1,8 @@
 package cn.com.ctop.kuaishou.modules.report.service;
 
 import cn.com.ctop.kuaishou.modules.report.entity.EtlKuaishouReportAccountDaily;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.service.IService;
 
 /**
@@ -13,4 +15,5 @@ public interface IEtlKuaishouReportAccountDailyService extends IService<EtlKuais
 
     void queryEveryDayDataForAccount();
 
+    JSONObject getReportData(String startDate, String endDate, JSONArray accountIds);
 }

+ 7 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/EtlKuaishouReportAccountDailyServiceImpl.java

@@ -6,6 +6,8 @@ import cn.com.ctop.kuaishou.modules.report.entity.EtlKuaishouReportAccountHourly
 import cn.com.ctop.kuaishou.modules.report.mapper.EtlKuaishouReportAccountDailyMapper;
 import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyAccountMapper;
 import cn.com.ctop.kuaishou.modules.report.service.IEtlKuaishouReportAccountDailyService;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -35,4 +37,9 @@ public class EtlKuaishouReportAccountDailyServiceImpl extends ServiceImpl<EtlKua
             etlDailyAccountMapper.replaceBatch(list);
         }
     }
+
+    @Override
+    public JSONObject getReportData(String startDate, String endDate, JSONArray accountIds) {
+        return etlDailyAccountMapper.getReportData(startDate, endDate, accountIds);
+    }
 }

+ 1 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/xml/BytedanceVideoReportMapper.xml

@@ -16,6 +16,7 @@
         t1.material_name AS materialName,
         t1.project_name AS projectName,
         t1.material_create_time AS createTime,
+        sum (t1.material_show) as showMaterial,
         ${filed}
         FROM
         etl_report_bytedance_video t1