Ver Fonte

Merge remote-tracking branch 'origin/V1.1.9' into V1.1.9

zhouzeyu@c-top.com.cn há 3 anos atrás
pai
commit
c047b23f31
100 ficheiros alterados com 8857 adições e 457 exclusões
  1. 25 0
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/DateUtils.java
  2. 2 0
      jeecg-boot-module-system/src/main/java/org/jeecg/config/ShiroConfig.java
  3. 15 11
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/CallbackController.java
  4. 81 15
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/UserAllocationController.java
  5. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/xml/MaterialReportOverViewMapper.xml
  6. 16 9
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/MaterialReportOverViewServiceImpl.java
  7. 3 3
      jeecg-boot-module-system/src/main/resources/application-dev.yml
  8. 6 6
      jeecg-boot-module-system/src/main/resources/jeecg/jeecg_database.properties
  9. 20 171
      jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java
  10. 14 4
      module-common/src/main/java/cn/com/ctop/common/module/mapper/UserAllocationMapper.java
  11. 52 8
      module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/UserAllocationMapper.xml
  12. 10 1
      module-common/src/main/java/cn/com/ctop/common/module/service/IUserAllocationService.java
  13. 29 2
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/UserAllocationServiceImpl.java
  14. 1 0
      module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceAiCreateJob.java
  15. 0 2
      module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceMaterialsLoadJob.java
  16. 177 0
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouAiProjectCreativeJob.java
  17. 2 1
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouAutoSynchronousProjectMaterialJob.java
  18. 1 1
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouDailyAccountReportLoadJob.java
  19. 76 0
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouDimensionCreateJob.java
  20. 5 2
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouVideoRelateCreativesJob.java
  21. 239 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/controller/AiKuaishouProjectCreateCreativeController.java
  22. 92 2
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/controller/KuaishouAppPackageController.java
  23. 67 7
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/controller/KuaishouDirectionalPackageController.java
  24. 24 11
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/controller/KuaishouPopulationPackageController.java
  25. 351 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/controller/KuaishouProjectStrategyController.java
  26. 7 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/controller/KuaishouVideoDirectionalPackageController.java
  27. 84 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/entity/AiKuaishouAccountLevelOperationRecord.java
  28. 85 41
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/entity/AiKuaishouCampaignLevelOperationRecord.java
  29. 4 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/entity/AiKuaishouCreativeLevelOperationRecord.java
  30. 107 52
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/entity/AiKuaishouProgramCreativeLevelOperationRecord.java
  31. 5 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/entity/AiKuaishouUnitLevelOperationRecord.java
  32. 13 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/entity/KuaishouAppPackageRel.java
  33. 77 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/entity/KuaishouMaterialPoolOperationRecord.java
  34. 377 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/entity/KuaishouProjectStrategy.java
  35. 101 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/enums/KuaishouProjectCreativeMatTypeEnum.java
  36. 20 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/AiKuaishouAccountLevelOperationRecordMapper.java
  37. 2 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/KuaishouAppPackageMapper.java
  38. 4 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/KuaishouAppPackageRelMapper.java
  39. 4 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/KuaishouDirectionalPackageMapper.java
  40. 2 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/KuaishouDirectionalPckageRelMapper.java
  41. 17 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/KuaishouMaterialPoolOperationRecordMapper.java
  42. 32 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/KuaishouProjectStrategyMapper.java
  43. 17 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/xml/AiKuaishouAccountLevelOperationRecordMapper.xml
  44. 14 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/xml/KuaishouAppPackageMapper.xml
  45. 31 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/xml/KuaishouAppPackageRelMapper.xml
  46. 20 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/xml/KuaishouDirectionalPackageMapper.xml
  47. 9 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/xml/KuaishouDirectionalPckageRelMapper.xml
  48. 5 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/xml/KuaishouMaterialPoolOperationRecordMapper.xml
  49. 200 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/xml/KuaishouProjectStrategyMapper.xml
  50. 15 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/IAiKuaishouAccountLevelOperationRecordService.java
  51. 19 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/IAiKuaishouProjectCreateCreativeService.java
  52. 7 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/IKuaishouAppPackageService.java
  53. 11 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/IKuaishouDirectionalPackageService.java
  54. 18 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/IKuaishouMaterialPoolOperationRecordService.java
  55. 1 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/IKuaishouPopulationPackageService.java
  56. 28 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/IKuaishouProjectStrategyService.java
  57. 19 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/AiKuaishouAccountLevelOperationRecordServiceImpl.java
  58. 1622 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/AiKuaishouProjectCreateCreativeServiceImpl.java
  59. 27 2
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/KuaishouAppPackageServiceImpl.java
  60. 29 3
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/KuaishouDirectionalPackageServiceImpl.java
  61. 68 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/KuaishouMaterialPoolOperationRecordServiceImpl.java
  62. 6 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/KuaishouPopulationPackageServiceImpl.java
  63. 92 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/KuaishouProjectStrategyServiceImpl.java
  64. 5 42
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/BatchController.java
  65. 39 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaiShouAppListController.java
  66. 15 3
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/entity/KuaiShouVideoGet.java
  67. 2 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/KuaiShouVideoGetMapper.java
  68. 7 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/KuaishouProjectVideoGetMapper.java
  69. 2 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/KuaishouTemplateTargetMapper.java
  70. 1 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouGroupTemplateMapper.xml
  71. 10 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouVideoGetMapper.xml
  72. 120 6
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaishouProjectVideoGetMapper.xml
  73. 11 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaishouTemplateTargetMapper.xml
  74. 2 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaiShouVideoGetService.java
  75. 7 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaishouProjectVideoGetService.java
  76. 11 12
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouVideoGetServiceImpl.java
  77. 84 23
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl.java
  78. 16 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouProjectVideoGetServiceImpl.java
  79. 12 10
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouVideoRelateCreativesServiceImpl.java
  80. 310 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/controller/KuaiShouDimensionAccountController.java
  81. 231 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/controller/KuaiShouDimensionAgeConfigController.java
  82. 241 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/controller/KuaiShouDimensionCampaignController.java
  83. 270 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/controller/KuaiShouDimensionCreativeController.java
  84. 282 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/controller/KuaiShouDimensionMaterialController.java
  85. 227 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/controller/KuaiShouDimensionRegionConfigController.java
  86. 238 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/controller/KuaiShouDimensionRegionDetailController.java
  87. 440 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/controller/KuaiShouDimensionStrategyController.java
  88. 356 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/controller/KuaiShouDimensionUnitController.java
  89. 292 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/controller/KuaiShouDimensionVariableController.java
  90. 90 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/entity/KuaiShouDimensionAccount.java
  91. 63 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/entity/KuaiShouDimensionAgeConfig.java
  92. 81 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/entity/KuaiShouDimensionCampaign.java
  93. 131 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/entity/KuaiShouDimensionCreative.java
  94. 63 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/entity/KuaiShouDimensionMaterial.java
  95. 57 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/entity/KuaiShouDimensionRegionConfig.java
  96. 63 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/entity/KuaiShouDimensionRegionDetail.java
  97. 200 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/entity/KuaiShouDimensionStrategy.java
  98. 277 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/entity/KuaiShouDimensionUnit.java
  99. 93 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/entity/KuaiShouDimensionVariable.java
  100. 0 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/dimension/mapper/KuaiShouDimensionAccountMapper.java

+ 25 - 0
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/DateUtils.java

@@ -1641,6 +1641,31 @@ public class DateUtils extends PropertyEditorSupport {
 
         return days;
     }
+
+    /**
+     * 判断time是否在from,to之内
+     *
+     * @param time 指定日期
+     * @param from 开始日期
+     * @param to   结束日期
+     * @throws
+     */
+    public static boolean checkTimeLimit(Date time, Date from, Date to) {
+        Calendar date = Calendar.getInstance();
+        date.setTime(time);
+
+        Calendar after = Calendar.getInstance();
+        after.setTime(from);
+
+        Calendar before = Calendar.getInstance();
+        before.setTime(to);
+
+        if (date.after(after) && date.before(before)) {
+            return true;
+        } else {
+            return false;
+        }
+    }
 }
 
 

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

@@ -200,6 +200,8 @@ 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
         Map<String, Filter> filterMap = new HashMap<>(1);

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

@@ -163,12 +163,12 @@ public class CallbackController {
                     BigDecimal warningAmount = json.getBigDecimal("WarningAmount");
                     String systemType = json.getString("systemType");
 
-                    /* TODO
+
                     Integer autoDelivery = json.getInteger("autoDelivery");
                     String materialTypeStr = json.getString("materialType");
                     //物料类型,0-不同步,1应用包,(2人群包,3定向包)
                     JSONArray materialTypeArr = json.getJSONArray("materialType");
-*/
+
                     CtopOauthToken topOauthToken = new CtopOauthToken();
                     topOauthToken.setId(String.valueOf(accountId));
                     topOauthToken.setAppId(json.getLong("appId"));
@@ -203,7 +203,7 @@ public class CallbackController {
                     userAllocation.setSystemType(systemType);
                     // 获取快手昵称
                     userAllocation.setAuthName((String) advertiseBaseInfoMap.get("userName"));
-                    if(null!=authBeginTime&&!authBeginTime.trim().equals("")){
+                    if (null != authBeginTime && !authBeginTime.trim().equals("")) {
                         userAllocation.setAuthBeginTime(authBeginTime);
                     }
                     userAllocation.setMediaId(mediaId);
@@ -214,9 +214,9 @@ public class CallbackController {
                     userAllocation.setCreateTime(new Date());
                     userAllocation.setUpdateTime(new Date());
                     //自动投放,0关闭,1开启
-                    /* TODO
+
                     userAllocation.setAutoDelivery(autoDelivery);
-                    userAllocation.setMaterialType(materialTypeStr);*/
+                    userAllocation.setMaterialType(materialTypeStr);
                     allocationMapper.deleteById(userAllocation.getId());
                     Map<String, Object> deleteUserMap = new HashMap<>();
                     deleteUserMap.put("advertiser_id", advertiserId);
@@ -227,7 +227,7 @@ public class CallbackController {
                     if (i > 0) {
                         log.info("同步分配用户表完成,task_id:{},accountId:{}", state, accountId);
                     }
-                   /* TODO Integer materialType = materialTypeArr.getInteger(0);*/
+                    Integer materialType = materialTypeArr.getInteger(0);
                     //账号绑定
                     bindAccountAuthService.addBindAccount(accountId, KuaishouInterfaceConstant.LOGIN_TYPE_KUAISHOU, advertiserId);
                     Thread t = new Thread() {
@@ -235,10 +235,10 @@ public class CallbackController {
                         public void run() {
                             try {
                                 kuaishouInterfaceService.loadKuaishouDataSingle(topOauthToken);
-                                /* TODO
+
                                 if (!Check.isNull(materialType) && materialType != 0) {
                                     synchronMaterials(materialType, accountId, projectId);
-                                }*/
+                                }
                             } catch (ParseException e) {
                                 e.printStackTrace();
                             }
@@ -260,10 +260,14 @@ public class CallbackController {
             accountIds.add(accountId);
             //1 有效项目模板
             List<Long> ids = kuaishouAppPackageService.queryByAppVersion(projectId, null, 1);
+            JSONObject data = new JSONObject();
+            data.put("accountIds", accountIds);
+            data.put("message", "授权同步应用");
             log.info("同步账户应用,应用模板={}", ids);
             if (!Check.isNull(ids)) {
                 for (Long id : ids) {
-                    kuaishouAppPackageService.pushAppPackage(id, accountIds);
+                    data.put("id", id);
+                    kuaishouAppPackageService.pushAppPackage(id, accountIds, data);
                 }
             }
         }
@@ -381,7 +385,7 @@ public class CallbackController {
                             userAllocation.setProjectId(projectId);
                             userAllocation.setSystemType(systemType);
                             userAllocation.setAuthName((String) advertiserDataMap.get("name"));
-                            if(null!=authBeginTime&&!authBeginTime.trim().equals("")){
+                            if (null != authBeginTime && !authBeginTime.trim().equals("")) {
                                 userAllocation.setAuthBeginTime(authBeginTime);
                             }
                             userAllocation.setAdvertiserId(advertiserId);
@@ -436,7 +440,7 @@ public class CallbackController {
                     userAllocation.setProjectId(projectId);
                     userAllocation.setSystemType(systemType);
                     userAllocation.setAuthName((String) advertiserDataMap.get("name"));
-                    if(null!=authBeginTime&&!authBeginTime.trim().equals("")){
+                    if (null != authBeginTime && !authBeginTime.trim().equals("")) {
                         userAllocation.setAuthBeginTime(authBeginTime);
                     }
                     userAllocation.setAdvertiserId(advertiserId);

+ 81 - 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);
         }
@@ -269,6 +334,7 @@ public class UserAllocationController {
                  queryWrapper.eq("media_id", project.getMediaId());
             }*/
             queryWrapper.isNotNull("account_id");
+            queryWrapper.orderByDesc("create_time");
             List<UserAllocation> userAllocations = userAllocationMapper.selectList(queryWrapper);
             result.setSuccess(true);
             result.setResult(userAllocations);
@@ -364,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 {
@@ -373,7 +439,7 @@ public class UserAllocationController {
         } catch (Exception e) {
             e.printStackTrace();
         }
-        return  Result.error("查询失败");
+        return Result.error("查询失败");
     }
 
 

+ 1 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/xml/MaterialReportOverViewMapper.xml

@@ -433,7 +433,7 @@
                 #{item}
             </foreach>
         </if>
-        AND stat_datetime &gt; #{startDate}
+        AND stat_datetime &gt;= #{startDate}
         AND stat_datetime &lt;= #{endDate}
         AND md5!=''
         GROUP BY md5

+ 16 - 9
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/MaterialReportOverViewServiceImpl.java

@@ -29,6 +29,7 @@ import java.io.OutputStream;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.text.ParseException;
+import java.text.SimpleDateFormat;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -85,6 +86,10 @@ public class MaterialReportOverViewServiceImpl implements IMaterialReportOverVie
 
     @Override
     public Map<String, Object> getTotalModule(int mediaId, String startDate, String endDate, JSONArray projects) {
+
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+        String nowData = sdf.format(new Date());
+
         Map<String, Object> result = new HashMap<>();
         if (projects.isEmpty()) {
             projects = getProjectsByCurrentUser(mediaId);
@@ -98,9 +103,9 @@ public class MaterialReportOverViewServiceImpl implements IMaterialReportOverVie
             //同比 (本阶段截止昨天消耗-上一个阶段截止和昨天对应日期的消耗)/上一个阶段截止和昨天对应日期的消耗 X 100%
             result.put("yearOnYearCompare", countLink(cost,lastCost));
             //昨日消耗
-            BigDecimal yesterdayCost = materialReportOverViewMapper.queryBytedanceCost(endDate, endDate, projects);
+            BigDecimal yesterdayCost = materialReportOverViewMapper.queryBytedanceCost(DateUtils.addDay(nowData, -1), DateUtils.addDay(nowData, -1), projects);
             //前天消耗
-            BigDecimal beforeYesterdayCost = materialReportOverViewMapper.queryBytedanceCost(DateUtils.addDay(endDate, -1), DateUtils.addDay(endDate, -1), projects);
+            BigDecimal beforeYesterdayCost = materialReportOverViewMapper.queryBytedanceCost(DateUtils.addDay(nowData, -2), DateUtils.addDay(nowData, -2), projects);
             result.put("yesterdayCost", yesterdayCost);
             //环比 (昨日消耗-前日消耗)/前日消耗 X 100%
             result.put("chainCompare", countLink(yesterdayCost,beforeYesterdayCost));
@@ -114,9 +119,9 @@ public class MaterialReportOverViewServiceImpl implements IMaterialReportOverVie
             //同比 (本阶段截止昨天消耗-上一个阶段截止和昨天对应日期的消耗)/上一个阶段截止和昨天对应日期的消耗 X 100%
             result.put("yearOnYearCompare", countLink(cost,lastCost));
             //昨日消耗
-            BigDecimal yesterdayCost = materialReportOverViewMapper.queryKuaishouCost(endDate, endDate, projects);
+            BigDecimal yesterdayCost = materialReportOverViewMapper.queryKuaishouCost(DateUtils.addDay(nowData, -1), DateUtils.addDay(nowData, -1), projects);
             //前天消耗
-            BigDecimal beforeYesterdayCost = materialReportOverViewMapper.queryKuaishouCost(DateUtils.addDay(endDate, -1), DateUtils.addDay(endDate, -1), projects);
+            BigDecimal beforeYesterdayCost = materialReportOverViewMapper.queryKuaishouCost(DateUtils.addDay(nowData, -2), DateUtils.addDay(nowData, -2), projects);
             result.put("yesterdayCost", yesterdayCost);
             //环比 (昨日消耗-前日消耗)/前日消耗 X 100%
             result.put("chainCompare", countLink(yesterdayCost,beforeYesterdayCost));
@@ -178,6 +183,8 @@ public class MaterialReportOverViewServiceImpl implements IMaterialReportOverVie
     //爆款视频
     @Override
     public Map<String, Object> sumDataVideoHot(int mediaId, String startDate, String endDate, JSONArray projects) {
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+        String nowData = sdf.format(new Date());
         Map<String, Object> result = new HashMap<>();
         if (projects.isEmpty()) {
             projects = getProjectsByCurrentUser(mediaId);
@@ -195,9 +202,9 @@ public class MaterialReportOverViewServiceImpl implements IMaterialReportOverVie
             //同比 (本阶段截止昨天的爆款视频数量-上一个阶段截止和昨天对应日期的爆款视频数量)/上一个阶段截止和昨天对应日期的爆款视频数量X 100%
             result.put("hotYearOnYearCompare", countLink(new BigDecimal(hotTotal),new BigDecimal(lastHotTotal)));
             //昨日消耗
-            List<Map<String, String>> yesterdayHost = materialReportOverViewMapper.selectHotMaterialVideoBytedance(endDate,endDate, projects);
+            List<Map<String, String>> yesterdayHost = materialReportOverViewMapper.selectHotMaterialVideoBytedance(DateUtils.addDay(nowData, -1),DateUtils.addDay(nowData, -1), projects);
             //前天消耗
-            List<Map<String, String>> beforeYesterdayHost = materialReportOverViewMapper.selectHotMaterialVideoBytedance(DateUtils.addDay(endDate, -1), DateUtils.addDay(endDate, -1), projects);
+            List<Map<String, String>> beforeYesterdayHost = materialReportOverViewMapper.selectHotMaterialVideoBytedance(DateUtils.addDay(nowData, -2), DateUtils.addDay(nowData, -2), projects);
             long yesterday = yesterdayHost.stream().collect(Collectors.summarizingInt(s->Integer.valueOf(String.valueOf(s.get("count"))))).getSum();
             long before = beforeYesterdayHost.stream().collect(Collectors.summarizingInt(s->Integer.valueOf(String.valueOf(s.get("count"))))).getSum();
             //环比 (昨日-前日)/前日消耗 X 100%
@@ -216,9 +223,9 @@ public class MaterialReportOverViewServiceImpl implements IMaterialReportOverVie
             //同比 (本阶段截止昨天的爆款视频数量-上一个阶段截止和昨天对应日期的爆款视频数量)/上一个阶段截止和昨天对应日期的爆款视频数量X 100%
             result.put("hotYearOnYearCompare", countLink(new BigDecimal(hotTotal),new BigDecimal(lastHotTotal)));
             //昨日消耗
-            List<Map<String, String>> yesterdayHost = materialReportOverViewMapper.selectHotMaterialVideoKs(endDate,endDate, projects);
+            List<Map<String, String>> yesterdayHost = materialReportOverViewMapper.selectHotMaterialVideoKs(DateUtils.addDay(nowData, -1),DateUtils.addDay(nowData, -1), projects);
             //前天消耗
-            List<Map<String, String>> beforeYesterdayHost = materialReportOverViewMapper.selectHotMaterialVideoKs(DateUtils.addDay(endDate, -1), DateUtils.addDay(endDate, -1), projects);
+            List<Map<String, String>> beforeYesterdayHost = materialReportOverViewMapper.selectHotMaterialVideoKs(DateUtils.addDay(nowData, -2), DateUtils.addDay(nowData, -2), projects);
             long yesterday = yesterdayHost.stream().collect(Collectors.summarizingInt(s->Integer.valueOf(String.valueOf(s.get("count"))))).getSum();
             long before = beforeYesterdayHost.stream().collect(Collectors.summarizingInt(s->Integer.valueOf(String.valueOf(s.get("count"))))).getSum();
             //环比 (昨日-前日)/前日消耗 X 100%
@@ -491,7 +498,7 @@ public class MaterialReportOverViewServiceImpl implements IMaterialReportOverVie
         if (roleCode.equals("admin")) {
             return null;
         }
-        return queryProjectIdBy(recursiveQuerySubordinate(currentUser), mediaId);
+        return Check.isNull(queryProjectIdBy(recursiveQuerySubordinate(currentUser), mediaId)) ? null : queryProjectIdBy(recursiveQuerySubordinate(currentUser), mediaId);
     }
     private List<String> getfileIds(Map<String, Map<String, Object>> kuaishouVideoReportMap, JSONArray columns) {
         List<String> titles = new ArrayList<>();

+ 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(10291211L);
-        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
-        Date parse = simpleDateFormat.parse("2021-07-11");
-        Date pars1 = simpleDateFormat.parse("2021-07-12");
-        iKuaishouInterfaceService.getGroupList(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("走完了~");
-    }
-
 }

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

@@ -37,17 +37,27 @@ 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);
 }

+ 52 - 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,50 @@
             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}
+        where account_id = #{accountId}
+    </update>
+
+    <select id="queryAutomaticAccounts" resultType="java.lang.Long">
+        select account_id from ctop_user_allocation
+        where project_id = #{projectId}
+        AND auto_delivery = 1
+    </select>
 
 </mapper>

+ 10 - 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,4 +59,12 @@ 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);
 }

+ 29 - 2
module-common/src/main/java/cn/com/ctop/common/module/service/impl/UserAllocationServiceImpl.java

@@ -6,6 +6,7 @@ import cn.com.ctop.common.module.service.IUserAllocationService;
 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;
@@ -158,8 +159,8 @@ public class UserAllocationServiceImpl extends ServiceImpl<UserAllocationMapper,
     }
 
     @Override
-    public List<UserAllocation> getAccountListByUserIdAndProductId(String userId, Long projectId,Long productId) {
-        return userAllocationMapper.getAccountListByUserIdAndProductId(userId,projectId,productId);
+    public List<UserAllocation> getAccountListByUserIdAndProductId(String userId, Long projectId, Long productId) {
+        return userAllocationMapper.getAccountListByUserIdAndProductId(userId, projectId, productId);
     }
 
     @Override
@@ -190,4 +191,30 @@ public class UserAllocationServiceImpl extends ServiceImpl<UserAllocationMapper,
     public List<Long> getValidProjectIds(Integer mediaId) {
         return userAllocationMapper.getValidProjectIds(mediaId);
     }
+
+    @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;
+    }
+
+    @Override
+    public List<Long> queryAutomaticAccounts(Long projectId) {
+        return userAllocationMapper.queryAutomaticAccounts(projectId);
+    }
 }

+ 1 - 0
module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceAiCreateJob.java

@@ -10,6 +10,7 @@ import java.util.Date;
 @Component
 public class BytedanceAiCreateJob {
     private static final String URLPREFIX = "http://118.24.244.213:8808/bytedance-api/advertiser/aiBytedanceAdvertiserStrategy/autoCreateCreative?hour=";
+//    private static final String URLPREFIX = "http://gateway.tjyourong.com.cn/advertiser/aiBytedanceAdvertiserStrategy/autoCreateCreative?hour=";
     /**
      * 头条自动投放创建任务
      * @throws Exception

+ 0 - 2
module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceMaterialsLoadJob.java

@@ -57,8 +57,6 @@ public class BytedanceMaterialsLoadJob {
         } catch (InterruptedException e) {
             e.printStackTrace();
         }
-        //修改视频类型
-        videoInfoService.updateMaterialType();
         //修改图片类型
         imageInfoService.updateType();
         XxlJobHelper.log("物料数据同步完成");

+ 177 - 0
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouAiProjectCreativeJob.java

@@ -0,0 +1,177 @@
+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.ai.entity.KuaishouProjectStrategy;
+import cn.com.ctop.kuaishou.modules.ai.service.IKuaishouProjectStrategyService;
+import com.alibaba.fastjson.JSONObject;
+import com.xxl.job.core.handler.annotation.XxlJob;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.util.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+import java.text.ParseException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author syh
+ * 自动投放定时任务
+ */
+@Component
+@Slf4j
+public class KuaishouAiProjectCreativeJob {
+
+    @Value("${xxl-job.requestUrl}")
+    private String jobUrl;
+
+    @Autowired
+    private IKuaishouProjectStrategyService kuaishouProjectStrategyService;
+
+    /**
+     * 项目自定义上新
+     */
+    @XxlJob("projectCustomCreativeOnNew")
+    public void projectCustomCreativeOnNew() {
+        List<KuaishouProjectStrategy> strategies = kuaishouProjectStrategyService.getAllEffectStrategy(4, "1");
+        if (null == strategies || strategies.isEmpty()) {
+            return;
+        }
+        String url = jobUrl + "/jeecg-boot/ai/projectCreate/projectCreative";
+        JSONObject jsonObject = null;
+        try {
+            for (KuaishouProjectStrategy strategy : strategies) {
+                Map<String, Object> requestMap = new HashMap<>();
+                requestMap.put("id", strategy.getId());
+                String result = HttpUtils2.httpGet(url, requestMap, null);
+                jsonObject = JSONObject.parseObject(result);
+                if (!Check.isNull(jsonObject)) {
+                    Integer code = jsonObject.getInteger("code");
+                    if (!Check.isNull(code) && code == 0) {
+                        log.info("快手自动上新异步执行中,accountId:{}", strategy.getProjectId());
+                    } else {
+                        log.error("快手自动上新异步执行失败,accountId:{},结果:{}", strategy.getProjectId(), jsonObject);
+                    }
+                } else {
+                    log.info("快手自动上新返回结果为空,accountId:{},结果:{}", strategy.getProjectId(), jsonObject);
+                }
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error("自定义上新异常,返回结果:{}", jsonObject);
+        }
+    }
+
+    /**
+     * 项目自定义补充
+     */
+    @XxlJob("projectCustomCreativeSupplement")
+    public void projectCustomCreativeSupplement() {
+        List<KuaishouProjectStrategy> strategies = kuaishouProjectStrategyService.getAllEffectStrategy(4, null);
+        if (null == strategies || strategies.isEmpty()) {
+            return;
+        }
+        JSONObject jsonObject = null;
+        try {
+            String url = jobUrl + "/jeecg-boot/ai/projectCreate/projectCreativeSupplement";
+            int hour = DateUtils.getNowHour();
+            for (KuaishouProjectStrategy strategy : strategies) {
+                Map<String, Object> requestMap = new HashMap<>();
+                requestMap.put("id", strategy.getId());
+                requestMap.put("hour", hour);
+                String result = HttpUtils2.httpGet(url, requestMap, null);
+                jsonObject = JSONObject.parseObject(result);
+                if (!Check.isNull(jsonObject)) {
+                    Integer code = jsonObject.getInteger("code");
+                    if (!Check.isNull(code) && code == 0) {
+                        log.info("快手创意补充异步执行中,accountId:{}", strategy.getAccountId());
+                    } else {
+                        log.error("快手创意补充异步执行失败,accountId:{},结果:{}", strategy.getAccountId(), jsonObject);
+                    }
+                } else {
+                    log.error("快手创意补充返回结果为空,accountId:{},结果:{}", strategy.getAccountId(), jsonObject);
+                }
+            }
+        } catch (ParseException e) {
+            e.printStackTrace();
+            log.error("自定义创意补充异常,返回结果:{}", jsonObject);
+        }
+    }
+
+    /**
+     * 项目程序化上新创意
+     */
+    @XxlJob("projectProgramCreativeAuto")
+    public void kuaishouProgramCreativeAuto() {
+        List<KuaishouProjectStrategy> strategies = kuaishouProjectStrategyService.getAllEffectStrategy(7, "1");
+        if (null == strategies || strategies.isEmpty()) {
+            return;
+        }
+        JSONObject jsonObject = null;
+        try {
+            String url = jobUrl + "/jeecg-boot/ai/projectCreate/projectProgramAutomaticCreates";
+            for (KuaishouProjectStrategy strategy : strategies) {
+                long videoCnt = strategy.getProgramUnitCnt() * 5 / 2;
+                Map<String, Object> requestMap = new HashMap<>();
+                requestMap.put("id", strategy.getId());
+                requestMap.put("videoCnt", videoCnt);
+                String result = HttpUtils2.httpGet(url, requestMap, null);
+                jsonObject = JSONObject.parseObject(result);
+                if (!Check.isNull(jsonObject)) {
+                    Integer code = jsonObject.getInteger("code");
+                    if (!Check.isNull(code) && code == 0) {
+                        log.info("程序化创意上新异步执行中,accountId:{}", strategy.getAccountId());
+                    } else {
+                        log.error("程序化创意上新异步执行失败,accountId:{},结果:{}", strategy.getAccountId(), jsonObject);
+                    }
+                } else {
+                    log.error("程序化创意上新返回结果为空,accountId:{},结果:{}", strategy.getAccountId(), jsonObject);
+                }
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error("程序化创意上新异常,返回结果:{}", jsonObject);
+        }
+    }
+
+    /**
+     * 项目程序化高质量创意
+     */
+    @XxlJob("projectProgramCreativeTop")
+    public void kuaishouProgramCreativeTop() {
+        List<KuaishouProjectStrategy> strategies = kuaishouProjectStrategyService.getAllEffectStrategy(7, "2");
+        if (null == strategies || strategies.isEmpty()) {
+            return;
+        }
+        JSONObject jsonObject = null;
+
+        try {
+            String url = jobUrl + "/jeecg-boot/ai/projectCreate/projectProgramCreativeTop";
+            for (KuaishouProjectStrategy strategy : strategies) {
+                long videoCnt = strategy.getProgramUnitCnt() * 5 / 2;
+                Map<String, Object> requestMap = new HashMap<>();
+                requestMap.put("id", strategy.getId());
+                requestMap.put("videoCnt", videoCnt);
+                String result = HttpUtils2.httpGet(url, requestMap, null);
+                jsonObject = JSONObject.parseObject(result);
+                if (!Check.isNull(jsonObject)) {
+                    Integer code = jsonObject.getInteger("code");
+                    if (!Check.isNull(code) && code == 0) {
+                        log.info("程序化高质量创建异步执行中,accountId:{}", strategy.getAccountId());
+                    } else {
+                        log.error("程序化高质量创建异步执行失败,accountId:{},结果:{}", strategy.getAccountId(), jsonObject);
+                    }
+                } else {
+                    log.error("程序化高质量创建返回结果为空,accountId:{},结果:{}", strategy.getAccountId(), jsonObject);
+                }
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error("程序化高质量创建异常,返回结果:{}", jsonObject);
+        }
+
+    }
+}

+ 2 - 1
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouAutoSynchronousProjectMaterialJob.java

@@ -5,6 +5,7 @@ import cn.com.ctop.common.module.service.IUserAllocationService;
 import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.kuaishou.modules.ai.service.IKuaishouAppPackageService;
 import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
 import com.xxl.job.core.context.XxlJobHelper;
 import com.xxl.job.core.handler.annotation.XxlJob;
 import lombok.extern.slf4j.Slf4j;
@@ -43,7 +44,7 @@ public class KuaishouAutoSynchronousProjectMaterialJob {
             log.info("同步账户应用,应用模板={}", ids);
             if (!Check.isNull(ids)) {
                 for (Long id : ids) {
-                    kuaishouAppPackageService.pushAppPackage(id, accountIds);
+                    kuaishouAppPackageService.pushAppPackage(id, accountIds,null);
                 }
             }
         }

+ 1 - 1
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouDailyAccountReportLoadJob.java

@@ -34,7 +34,7 @@ public class KuaishouDailyAccountReportLoadJob {
      */
     @XxlJob("kuaishouDailyAccountReport")
     public void execute() throws Exception {
-        Date getDate = DateUtils.addDay(new Date(), -1);
+        Date getDate = new Date();
         Date getDate2 = DateUtils.addDay(new Date(), -2);
         //1:查询当日数据
         List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();

+ 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 - 2
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouVideoRelateCreativesJob.java

@@ -40,6 +40,7 @@ public class KuaishouVideoRelateCreativesJob {
 
     /**
      * 视频库-更新视频关联创意数
+     *
      * @throws Exception
      */
     @XxlJob("kuaishouVideoRelateCreativesJob")
@@ -90,7 +91,7 @@ public class KuaishouVideoRelateCreativesJob {
             int count = 0;
             for (KuaiShouVideoGet video : KuaiShouVideoGets) {
                 count++;
-                if (count < 20) {
+                if (count < 19) {
                     photoIds.add(video.getPhotoId());
                     statdateMap.put(video.getPhotoId(), video);
                 } else {
@@ -101,7 +102,9 @@ public class KuaishouVideoRelateCreativesJob {
                     count = 0;
                 }
             }
-            dateList.add(photoIds);
+            if (photoIds.size() > 0) {
+                dateList.add(photoIds);
+            }
             kuaishouVideoRelateCreativesService.videoRelateCreatives(accountId, dateList, statdateMap);
         }
     }

+ 239 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/controller/AiKuaishouProjectCreateCreativeController.java

@@ -0,0 +1,239 @@
+package cn.com.ctop.kuaishou.modules.ai.controller;
+
+import cn.com.ctop.common.module.service.IUserAllocationService;
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.kuaishou.modules.ai.entity.KuaishouProjectStrategy;
+import cn.com.ctop.kuaishou.modules.ai.service.IAiKuaishouProjectCreateCreativeService;
+import cn.com.ctop.kuaishou.modules.ai.service.IKuaishouProjectStrategyService;
+import com.alibaba.fastjson.JSONObject;
+import io.swagger.annotations.Api;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.text.ParseException;
+import java.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+@Slf4j
+@Api(tags = "快手-自动投放")
+@RestController
+@RequestMapping("/ai/projectCreate")
+public class AiKuaishouProjectCreateCreativeController {
+    @Autowired
+    private IAiKuaishouProjectCreateCreativeService projectCreateCreativeService;
+    @Autowired
+    private IKuaishouProjectStrategyService kuaishouProjectStrategyService;
+    @Autowired
+    private IUserAllocationService userAllocationService;
+
+
+    static ExecutorService executorService = Executors.newFixedThreadPool(5);
+    static ExecutorService kuaishouCustomCreativeSupplementExecutorService = Executors.newFixedThreadPool(3);
+
+    /**
+     * 检查匹配
+     *
+     * @param id
+     * @return
+     */
+    @GetMapping(value = "/projectAutomaticCreates")
+    public JSONObject projectAutomaticCreates(String id, Integer operationType) {
+        JSONObject returnJson = new JSONObject();
+        try {
+            if (Check.isNull(id) || Check.isNull(operationType)) {
+                throw new Exception("参数为空");
+            }
+            KuaishouProjectStrategy strategy = kuaishouProjectStrategyService.getById(id);
+            if (Check.isNull(strategy)) {
+                throw new Exception("根据id获取详细信息为空");
+            }
+            Long projectId = strategy.getProjectId();
+            List<Long> list = userAllocationService.queryAutomaticAccounts(projectId);
+            if (Check.isNull(list)) {
+                throw new Exception("项目:" + projectId + "中未配置自动投放账户!");
+            }
+            list.forEach(accountId -> executorService.submit(() -> {
+                Boolean unitOverrun = projectCreateCreativeService.getUnitOverrun(projectId.toString().concat(accountId.toString()));
+                if (!unitOverrun) {
+                    strategy.setAccountId(accountId);
+                    // operationType 1检查反馈,2创建时信息
+                    projectCreateCreativeService.projectAutomaticCreates(strategy, operationType);
+                }
+            }));
+            returnJson.put("code", 0);
+            returnJson.put("message", "自定义上新异步创建中");
+        } catch (Exception e) {
+            log.error("项目自动创建异常", e.fillInStackTrace());
+            returnJson.put("code", -1);
+            returnJson.put("message", e.getMessage());
+        }
+        return returnJson;
+    }
+
+
+    /**
+     * 项目自定义上新
+     *
+     * @param id
+     * @return
+     */
+    @GetMapping(value = "/projectCreative")
+    public JSONObject projectCreative(String id) {
+        JSONObject returnJson = new JSONObject();
+        try {
+            if (Check.isNull(id)) {
+                throw new Exception("参数为空");
+            }
+            KuaishouProjectStrategy strategy = kuaishouProjectStrategyService.getById(id);
+            if (Check.isNull(strategy)) {
+                throw new Exception("根据id获取详细信息为空");
+            }
+            Long projectId = strategy.getProjectId();
+            List<Long> list = userAllocationService.queryAutomaticAccounts(projectId);
+            if (Check.isNull(list)) {
+                throw new Exception("项目:" + projectId + "中未配置自动投放账户!");
+            }
+            list.forEach(accountId -> executorService.submit(() -> {
+                Boolean unitOverrun = projectCreateCreativeService.getUnitOverrun(projectId.toString().concat(accountId.toString()));
+                if (!unitOverrun) {
+                    strategy.setAccountId(accountId);
+                    projectCreateCreativeService.projectAutomaticCreates(strategy);
+                }
+            }));
+            returnJson.put("code", 0);
+            returnJson.put("message", "自定义上新异步创建中");
+        } catch (Exception e) {
+            log.error("项目自动创建异常", e.fillInStackTrace());
+            returnJson.put("code", -1);
+            returnJson.put("message", e.getMessage());
+        }
+        return returnJson;
+    }
+
+    /**
+     * 项目维度自定义创意补充
+     *
+     * @param id
+     * @param hour
+     * @return
+     */
+    @GetMapping(value = "/projectCreativeSupplement")
+    public JSONObject projectCreativeSupplement(String id, Integer hour) {
+        JSONObject returnJson = new JSONObject();
+        try {
+            if (Check.isNull(id)) {
+                throw new Exception("主键id不能为空");
+            }
+            KuaishouProjectStrategy strategy = kuaishouProjectStrategyService.getById(id);
+            if (Check.isNull(strategy)) {
+                throw new Exception("根据id获取详细信息为空");
+            }
+            Long projectId = strategy.getProjectId();
+            List<Long> list = userAllocationService.queryAutomaticAccounts(projectId);
+            if (Check.isNull(list)) {
+                throw new Exception("项目:" + projectId + "中未配置自动投放账户!");
+            }
+            list.forEach(accountId -> executorService.submit(() -> {
+                Boolean unitOverrun = projectCreateCreativeService.getUnitOverrun(projectId.toString().concat(accountId.toString()));
+                if (!unitOverrun) {
+                    strategy.setAccountId(accountId);
+                    try {
+                        projectCreateCreativeService.customCreativeSupplement(strategy, hour);
+                    } catch (ParseException e) {
+                        e.printStackTrace();
+                    }
+                }
+            }));
+            returnJson.put("code", 0);
+            returnJson.put("message", "自定义补充异步创建中...");
+        } catch (Exception e) {
+            returnJson.put("code", -1);
+            returnJson.put("message", e.getMessage());
+        }
+        return returnJson;
+    }
+
+
+    /**
+     * 项目程序化上新
+     *
+     * @param id
+     * @return
+     */
+    @GetMapping(value = "/projectProgramAutomaticCreates")
+    public JSONObject projectProgramAutomaticCreates(String id) {
+        JSONObject returnJson = new JSONObject();
+        try {
+            if (Check.isNull(id)) {
+                throw new Exception("参数为空");
+            }
+            KuaishouProjectStrategy strategy = kuaishouProjectStrategyService.getById(id);
+            if (Check.isNull(strategy)) {
+                throw new Exception("根据id获取详细信息为空");
+            }
+            Long projectId = strategy.getProjectId();
+            List<Long> list = userAllocationService.queryAutomaticAccounts(projectId);
+            if (Check.isNull(list)) {
+                throw new Exception("项目:" + projectId + "中未配置自动投放账户!");
+            }
+            list.forEach(accountId -> executorService.submit(() -> {
+                Boolean unitOverrun = projectCreateCreativeService.getUnitOverrun(projectId.toString().concat(accountId.toString()));
+                if (!unitOverrun) {
+                    strategy.setAccountId(accountId);
+                    projectCreateCreativeService.projectProgramAutomaticCreates(strategy, 1);
+                }
+            }));
+            returnJson.put("code", 0);
+            returnJson.put("message", "程序化上新异步创建中");
+        } catch (Exception e) {
+            log.error("项目自动创建异常", e.fillInStackTrace());
+            returnJson.put("code", -1);
+            returnJson.put("message", e.getMessage());
+        }
+        return returnJson;
+    }
+
+    /**
+     * 项目程序化高质量创意
+     *
+     * @param id
+     * @param hour
+     * @return
+     */
+    @GetMapping(value = "/projectProgramCreativeTop")
+    public JSONObject projectProgramCreativeSupplement(String id, Integer hour) {
+        JSONObject returnJson = new JSONObject();
+        try {
+            if (Check.isNull(id)) {
+                throw new Exception("参数为空");
+            }
+            KuaishouProjectStrategy strategy = kuaishouProjectStrategyService.getById(id);
+            if (Check.isNull(strategy)) {
+                throw new Exception("根据id获取详细信息为空");
+            }
+            Long projectId = strategy.getProjectId();
+            List<Long> list = userAllocationService.queryAutomaticAccounts(projectId);
+            if (Check.isNull(list)) {
+                throw new Exception("项目:" + projectId + "中未配置自动投放账户!");
+            }
+            list.forEach(accountId -> executorService.submit(() -> {
+                Boolean unitOverrun = projectCreateCreativeService.getUnitOverrun(projectId.toString().concat(accountId.toString()));
+                if (!unitOverrun) {
+                    strategy.setAccountId(accountId);
+                    projectCreateCreativeService.projectProgramAutomaticCreates(strategy, 2);
+                }
+            }));
+            returnJson.put("code", 0);
+            returnJson.put("message", "程序化高质量异步创建中");
+        } catch (Exception e) {
+            log.error("项目自动创建异常", e.fillInStackTrace());
+            returnJson.put("code", -1);
+            returnJson.put("message", e.getMessage());
+        }
+        return returnJson;
+    }
+}

+ 92 - 2
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/controller/KuaishouAppPackageController.java

@@ -7,7 +7,10 @@ import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.ExportExcelUtils;
 import cn.com.ctop.common.module.utils.LoadFileUtil;
 import cn.com.ctop.kuaishou.modules.ai.entity.KuaishouAppPackage;
+import cn.com.ctop.kuaishou.modules.ai.entity.KuaishouAppPackageRel;
+import cn.com.ctop.kuaishou.modules.ai.service.IKuaishouAppPackageRelService;
 import cn.com.ctop.kuaishou.modules.ai.service.IKuaishouAppPackageService;
+import cn.com.ctop.kuaishou.modules.ai.service.IKuaishouMaterialPoolOperationRecordService;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.github.pagehelper.PageHelper;
@@ -50,7 +53,11 @@ public class KuaishouAppPackageController {
     @Autowired
     private IKuaishouAppPackageService kuaishouAppPackageService;
     @Autowired
+    private IKuaishouAppPackageRelService kuaishouAppPackageRelService;
+    @Autowired
     private IProjectService projectService;
+    @Autowired
+    private IKuaishouMaterialPoolOperationRecordService kuaishouMaterialPoolOperationRecordService;
 
     /**
      * 分页列表查询
@@ -71,6 +78,79 @@ public class KuaishouAppPackageController {
         return Result.error("查询应用列表失败");
     }
 
+    @GetMapping(value = "/getProjectAppList")
+    public Result<Object> getProjectAppList(Long projectId) {
+        try {
+            if (Check.isNull(projectId)) {
+                return Result.error("缺少参数");
+            }
+            return kuaishouAppPackageService.getProjectAppList(projectId);
+        } catch (Exception e) {
+            log.error("查询项目下应用异常", e);
+        }
+        return Result.error("查询项目下应用失败");
+    }
+
+    @PostMapping(value = "/getAppsDetail")
+    public Result<Object> getAppsDetail(@RequestBody JSONObject data) {
+        try {
+            String ids = data.getString("apptemIds");
+            if (Check.isNull(ids)) {
+                return Result.error("缺少参数");
+            }
+            List<Long> list = JSONObject.parseObject(ids, List.class);
+            if (list.size() == 0) {
+                return Result.error("缺少参数");
+            }
+            return kuaishouAppPackageService.getAppsDetail(list);
+        } catch (Exception e) {
+            log.error("查询项目下应用异常", e);
+        }
+        return Result.error("查询项目下应用失败");
+    }
+
+    @PostMapping(value = "/edit")
+    public Result<Object> edit(@RequestBody JSONObject data) {
+        String impressionUrl = data.getString("impressionUrl");
+        String trackUrl = data.getString("trackUrl");
+        String actionbarClickUrl = data.getString("actionbarClickUrl");
+        String adPhotoPlayedT3sUrl = data.getString("adPhotoPlayedT3sUrl");
+
+        if (Check.isNull(impressionUrl) && Check.isNull(actionbarClickUrl) && Check.isNull(adPhotoPlayedT3sUrl) && Check.isNull(trackUrl)) {
+            return Result.error("缺少参数");
+        }
+        Long id = data.getLong("id");
+        KuaishouAppPackageRel packageRel = kuaishouAppPackageRelService.getById(id);
+        if (packageRel == null) {
+            return Result.error("未找到对应实体");
+        } else {
+            boolean ok = false;
+            if (!Check.isNull(impressionUrl) || !Check.isNull(actionbarClickUrl) || !Check.isNull(adPhotoPlayedT3sUrl)) {
+                if (!Check.isNull(impressionUrl)) {
+                    packageRel.setImpressionUrl(impressionUrl);
+                }
+                if (!Check.isNull(actionbarClickUrl)) {
+                    packageRel.setActionbarClickUrl(actionbarClickUrl);
+                }
+                if (!Check.isNull(adPhotoPlayedT3sUrl)) {
+                    packageRel.setAdPhotoPlayedT3sUrl(adPhotoPlayedT3sUrl);
+                }
+                ok = kuaishouAppPackageRelService.updateById(packageRel);
+            }
+            if (!Check.isNull(trackUrl)) {
+                KuaishouAppPackage appTem = kuaishouAppPackageService.getById(packageRel.getApptemId());
+                if (!Check.isNull(appTem)) {
+                    appTem.setTrackUrl(trackUrl);
+                    ok = kuaishouAppPackageService.updateById(appTem);
+                }
+            }
+            if (ok) {
+                return Result.ok("修改成功!");
+            }
+        }
+        return Result.error("修改失败");
+    }
+
     /**
      * 查询相关账户
      *
@@ -162,7 +242,8 @@ public class KuaishouAppPackageController {
             if (Check.isNull(accountIds)) {
                 return Result.error("请选择推送账户");
             }
-            return kuaishouAppPackageService.pushAppPackage(id, accountIds);
+            Result<Object> result = kuaishouAppPackageService.pushAppPackage(id, accountIds, requestJson);
+            return result;
         } catch (Exception e) {
             log.error("推送应用异常", e);
         }
@@ -282,7 +363,12 @@ public class KuaishouAppPackageController {
             }
             kuaishouAppPackage.setImageMd5(LoadFileUtil.getMD5(newFileUrl));
             kuaishouAppPackage.setDataStatus(1);//有效
+            String type = "update";
+            if (Check.isNull(kuaishouAppPackage.getId())) {
+                type = "add";
+            }
             kuaishouAppPackageService.saveOrUpdate(kuaishouAppPackage);
+            kuaishouMaterialPoolOperationRecordService.addRecord(JSONObject.parseObject(JSONObject.toJSONString(kuaishouAppPackage)).toJavaObject(JSONObject.class), "/fillInLink", 3, type);
             return Result.ok("操作成功!");
         } catch (Exception e) {
             log.error(e.getMessage(), e);
@@ -302,7 +388,7 @@ public class KuaishouAppPackageController {
             if (Check.isNull(projectId) || Check.isNull(appVersion)) {
                 return Result.error("缺失参数");
             }
-            List<Long> list = kuaishouAppPackageService.queryByAppVersion(projectId, appVersion,null);
+            List<Long> list = kuaishouAppPackageService.queryByAppVersion(projectId, appVersion, null);
             if (Check.isNull(list)) {
                 return Result.ok("success");
             } else {
@@ -334,6 +420,10 @@ public class KuaishouAppPackageController {
             kuaishouAppPackage.setDataStatus(0);
             boolean ok = kuaishouAppPackageService.updateById(kuaishouAppPackage);
             if (ok) {
+                JSONObject data = new JSONObject();
+                data.put("id", kuaishouAppPackage.getId());
+                data.put("projectId", kuaishouAppPackageEntity.getProjectId());
+                kuaishouMaterialPoolOperationRecordService.addRecord(data, "/kuaishouAppPackage/delete", 3, "delete");
                 result.success("刪除成功!");
             }
         }

+ 67 - 7
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/controller/KuaishouDirectionalPackageController.java

@@ -6,16 +6,16 @@ import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.QueryGenerator;
 import cn.com.ctop.kuaishou.modules.ai.entity.KuaishouDirectionalPackage;
 import cn.com.ctop.kuaishou.modules.ai.service.IKuaishouDirectionalPackageService;
+import cn.com.ctop.kuaishou.modules.ai.service.IKuaishouMaterialPoolOperationRecordService;
 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 com.github.pagehelper.PageHelper;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
+import org.checkerframework.checker.units.qual.C;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.util.oConvertUtils;
 import org.jeecgframework.poi.excel.ExcelImportUtil;
@@ -62,6 +62,9 @@ public class KuaishouDirectionalPackageController {
     private IKuaishouDirectionalPackageService kuaishouDirectionalPackageService;
 
     @Autowired
+    private IKuaishouMaterialPoolOperationRecordService kuaishouMaterialPoolOperationRecordService;
+
+    @Autowired
     private ICtopOauthTokenService oauthTokenService;
 
     /**
@@ -85,6 +88,42 @@ public class KuaishouDirectionalPackageController {
 
     }
 
+    @GetMapping(value = "/getProjectTarget")
+    public Result<Object> getProjectTarget(Long projectId, String templateName,
+                                           @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                           @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
+        try {
+            if (Check.isNull(projectId)) {
+                return Result.error("缺少参数");
+            }
+            return kuaishouDirectionalPackageService.getProjectTarget(projectId, templateName, pageNo, pageSize);
+        } catch (Exception e) {
+            log.error("查询异常,", e);
+            return Result.error("查询失败," + e.getMessage());
+        }
+    }
+
+    @PostMapping(value = "/getProjectTargetByIds")
+    public Result<Object> getProjectTargetByIds(@RequestBody JSONObject data) {
+        try {
+            JSONArray ids = data.getJSONArray("ids");
+            if (Check.isNull(ids)) {
+                return Result.error("缺少参数");
+            }
+            List<String> list = JSONObject.parseObject(JSONObject.toJSONString(ids), List.class);
+            if (Check.isNull(list)) {
+                return Result.error("缺少参数");
+            }
+
+
+            List<KuaishouDirectionalPackage> targets = kuaishouDirectionalPackageService.getProjectTargetByIds(list);
+            return Result.ok(targets);
+        } catch (Exception e) {
+            log.error("查询异常,", e);
+            return Result.error("查询失败," + e.getMessage());
+        }
+    }
+
     /**
      * 相关账户/组
      *
@@ -134,7 +173,11 @@ public class KuaishouDirectionalPackageController {
             if (Check.isNull(requestJson.getString("templateName"))) {
                 return Result.error("未获取到定向包名称");
             }
-            return kuaishouDirectionalPackageService.editPopulation(requestJson);
+            Result<Object> result = kuaishouDirectionalPackageService.editPopulation(requestJson);
+            if (result.getCode() == 200) {
+                kuaishouMaterialPoolOperationRecordService.addRecord(requestJson, "/editPopulation", 1, "update");
+            }
+            return result;
         } catch (Exception e) {
             log.error("查询异常,", e.getMessage());
             e.printStackTrace();
@@ -178,7 +221,6 @@ public class KuaishouDirectionalPackageController {
      */
     @PostMapping(value = "/createDirectionalPackage")
     public Result<Object> createDirectionalPackage(@RequestBody JSONObject requestJson) {
-        Result<JSONObject> result = new Result<>();
         try {
             if (Check.isNull(requestJson.getString("templateName"))) {
                 return Result.error("定向模板名称为必传项");
@@ -187,7 +229,11 @@ public class KuaishouDirectionalPackageController {
             if (Check.isNull(accountId)) {
                 return Result.error("请选择账户id");
             }
-            return kuaishouDirectionalPackageService.createDirectionalPackage(requestJson);
+            Result<Object> result = kuaishouDirectionalPackageService.createDirectionalPackage(requestJson);
+            if (result.getCode() == 200) {
+                kuaishouMaterialPoolOperationRecordService.addRecord(requestJson, "/createDirectionalPackage", 1, "add");
+            }
+            return result;
         } catch (Exception e) {
             log.error("创建定向包失败", e);
             return Result.error("创建失败" + e.getMessage());
@@ -210,7 +256,11 @@ public class KuaishouDirectionalPackageController {
             if (Check.isNull(requestJson.getString("projectId"))) {
                 return Result.error("请选择项目");
             }
-            return kuaishouDirectionalPackageService.updateDirectionalPackage(requestJson);
+            Result<Object> result1 = kuaishouDirectionalPackageService.updateDirectionalPackage(requestJson);
+            if (result1.getCode() == 200) {
+                kuaishouMaterialPoolOperationRecordService.addRecord(requestJson, "/updateDirectionalPackage", 1, "update");
+            }
+            return result1;
         } catch (Exception e) {
             result.setSuccess(false);
             result.setMessage(e.getMessage());
@@ -235,7 +285,8 @@ public class KuaishouDirectionalPackageController {
             if (Check.isNull(datas)) {
                 return Result.error("请选择推送账户");
             }
-            return kuaishouDirectionalPackageService.pushDirectionalPackage(id, datas);
+            Result<Object> result = kuaishouDirectionalPackageService.pushDirectionalPackage(id, datas, requestJson);
+            return result;
         } catch (Exception e) {
             log.error("推送定向包异常", e);
         }
@@ -283,8 +334,17 @@ public class KuaishouDirectionalPackageController {
     @GetMapping(value = "/delete")
     public Result<Object> delete(String id) {
         try {
+
+            KuaishouDirectionalPackage directionalPackage = kuaishouDirectionalPackageService.getById(id);
+            if (Check.isNull(directionalPackage)) {
+                return Result.error("未查到实体");
+            }
             boolean b = kuaishouDirectionalPackageService.removeById(id);
             if (b) {
+                JSONObject data = new JSONObject();
+                data.put("id", id);
+                data.put("projectId", directionalPackage.getProjectId());
+                kuaishouMaterialPoolOperationRecordService.addRecord(data, "/kuaishouDirectionalPackage/delete", 1, "delete");
                 return Result.ok("删除成功");
             }
         } catch (Exception e) {

+ 24 - 11
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/controller/KuaishouPopulationPackageController.java

@@ -3,13 +3,13 @@ package cn.com.ctop.kuaishou.modules.ai.controller;
 import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.QueryGenerator;
 import cn.com.ctop.kuaishou.modules.ai.entity.KuaishouPopulationPackage;
+import cn.com.ctop.kuaishou.modules.ai.service.IKuaishouMaterialPoolOperationRecordService;
 import cn.com.ctop.kuaishou.modules.ai.service.IKuaishouPopulationPackageService;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.github.pagehelper.PageHelper;
-import com.github.pagehelper.PageInfo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
@@ -56,6 +56,8 @@ import java.util.Map;
 public class KuaishouPopulationPackageController {
     @Autowired
     private IKuaishouPopulationPackageService kuaishouPopulationPackageService;
+    @Autowired
+    private IKuaishouMaterialPoolOperationRecordService kuaishouMaterialPoolOperationRecordService;
 
     /**
      * 分页列表查询
@@ -161,18 +163,19 @@ public class KuaishouPopulationPackageController {
      * @author ZHAOXA
      */
     @GetMapping(value = "/getRelatedGroups")
-    public Result<Object> getRelatedGroups(Long id,Long accountId, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
+    public Result<Object> getRelatedGroups(Long id, Long accountId, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
         try {
             if (Check.isNull(id)) {
                 return Result.error("缺少参数");
             }
             PageHelper.startPage(pageNo, pageSize);
-            return kuaishouPopulationPackageService.getRelatedGroups(id,accountId);
+            return kuaishouPopulationPackageService.getRelatedGroups(id, accountId);
         } catch (Exception e) {
             log.error("查询异常", e);
         }
         return Result.error("查询失败");
     }
+
     /**
      * 查询项目下有效账户
      *
@@ -216,13 +219,14 @@ public class KuaishouPopulationPackageController {
     @RequestMapping(value = "/checkPopulationPackage")
     public Result<Object> checkPopulationPackage(String signature) {
         try {
-           return kuaishouPopulationPackageService.checkPopulationPackage(signature);
+            return kuaishouPopulationPackageService.checkPopulationPackage(signature);
         } catch (Exception e) {
             log.error("查询异常,", e.getMessage());
             e.printStackTrace();
         }
         return Result.error("查询失败");
     }
+
     /**
      * 添加
      *
@@ -232,7 +236,6 @@ public class KuaishouPopulationPackageController {
     @ApiOperation(value = "项目绑定的人群包模板-添加", notes = "项目绑定的人群包模板-添加")
     @PostMapping(value = "/add")
     public Result<Object> add(@RequestBody KuaishouPopulationPackage kuaishouPopulationPackage) {
-        Result<KuaishouPopulationPackage> result = new Result<>();
         try {
             if (Check.isNull(kuaishouPopulationPackage.getType())) {
                 return Result.error("请选择匹配类型");
@@ -246,12 +249,15 @@ public class KuaishouPopulationPackageController {
             if (Check.isNull(kuaishouPopulationPackage.getProjectId())) {
                 return Result.error("请选择项目");
             }
-            return kuaishouPopulationPackageService.createEntity(kuaishouPopulationPackage);
+            Result<Object> result = kuaishouPopulationPackageService.createEntity(kuaishouPopulationPackage);
+            if (result.getCode() == 200) {
+                kuaishouMaterialPoolOperationRecordService.addRecord(JSONObject.parseObject(JSONObject.toJSONString(kuaishouPopulationPackage)).toJavaObject(JSONObject.class), "/kuaishouPopulationPackage/add", 2, "add");
+            }
+            return result;
         } catch (Exception e) {
             log.error(e.getMessage(), e);
-            result.error500("上传异常");
+            return Result.error("上传异常");
         }
-        return Result.error("上传失败");
     }
 
     /**
@@ -269,7 +275,8 @@ public class KuaishouPopulationPackageController {
             if (Check.isNull(accountIds) || Check.isNull(id)) {
                 return Result.error("缺少参数");
             }
-            return kuaishouPopulationPackageService.push(accountIds, id);
+            Result<Object> result = kuaishouPopulationPackageService.push(accountIds, id, request);
+            return result;
         } catch (Exception e) {
             log.error("查询异常,", e.getMessage());
             e.printStackTrace();
@@ -290,11 +297,17 @@ public class KuaishouPopulationPackageController {
             if (Check.isNull(id)) {
                 return Result.error("参数为空");
             }
-            KuaishouPopulationPackage populationPackage = new KuaishouPopulationPackage();
-            populationPackage.setId(id);
+            KuaishouPopulationPackage populationPackage = kuaishouPopulationPackageService.getById(id);
+            if (Check.isNull(populationPackage)) {
+                return Result.error("未查到实体");
+            }
             populationPackage.setDataStatus(0);//逻辑删除
             boolean b = kuaishouPopulationPackageService.updateById(populationPackage);
             if (b) {
+                JSONObject data = new JSONObject();
+                data.put("id", id);
+                data.put("projectId", populationPackage.getProjectId());
+                kuaishouMaterialPoolOperationRecordService.addRecord(data, "/kuaishouPopulationPackage/delete", 2, "delete");
                 return Result.ok("删除成功!");
             }
         } catch (Exception e) {

+ 351 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/controller/KuaishouProjectStrategyController.java

@@ -0,0 +1,351 @@
+package cn.com.ctop.kuaishou.modules.ai.controller;
+
+import cn.com.ctop.common.module.entity.Project;
+import cn.com.ctop.common.module.entity.UserAllocation;
+import cn.com.ctop.common.module.service.IProjectService;
+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.ai.entity.KuaishouProjectStrategy;
+import cn.com.ctop.kuaishou.modules.ai.service.IKuaishouProjectStrategyService;
+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.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.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+import org.springframework.web.servlet.ModelAndView;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 自动投放-项目策略表
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2021-06-24
+ */
+@Slf4j
+@Api(tags = "自动投放-项目策略表")
+@RestController
+@RequestMapping("/kuaishouProjectStrategy")
+public class KuaishouProjectStrategyController {
+    @Autowired
+    private IKuaishouProjectStrategyService kuaishouProjectStrategyService;
+    @Autowired
+    private IUserAllocationService userAllocationService;
+    @Autowired
+    private IProjectService projectService;
+
+
+    /**
+     * 项目配置列表
+     */
+    @PostMapping(value = "/queryProjectList")
+    public Result<Object> queryProjectList(@RequestBody JSONObject data) {
+        try {
+            if (Check.isNull(data.getString("startTime")) || Check.isNull(data.getString("endTime"))) {
+                return Result.error("请选择查询时间");
+            }
+            return kuaishouProjectStrategyService.queryProjectList(data);
+        } catch (Exception e) {
+            log.error("查询异常,", e.getMessage());
+            e.printStackTrace();
+        }
+        return Result.error("查询失败");
+    }
+
+    /**
+     * 项目策略中账户列表
+     */
+    @PostMapping(value = "/queryAccountList")
+    public Result<Object> queryAccountList(@RequestBody JSONObject data) {
+        try {
+            if (Check.isNull(data.getString("startTime")) || Check.isNull(data.getString("endTime"))) {
+                return Result.error("请选择查询时间");
+            }
+            return kuaishouProjectStrategyService.queryAccountList(data);
+        } catch (Exception e) {
+            log.error("查询异常,", e.getMessage());
+            e.printStackTrace();
+        }
+        return Result.error("查询失败");
+    }
+
+    /**
+     * 修改项目策略状态
+     */
+    @PostMapping(value = "/updateProjectStrategy")
+    public Result<Object> updateProjectStrategy(@RequestBody KuaishouProjectStrategy kuaishouProjectStrategy) {
+        KuaishouProjectStrategy kuaishouProjectStrategyEntity = kuaishouProjectStrategyService.getById(kuaishouProjectStrategy.getId());
+        if (kuaishouProjectStrategyEntity == null) {
+            return Result.error("未找到对应实体");
+        } else {
+            boolean ok = kuaishouProjectStrategyService.updateById(kuaishouProjectStrategy);
+            if (ok) {
+                return Result.ok("修改成功!");
+            }
+        }
+        return Result.ok("修改失败!");
+    }
+
+    /**
+     * 修改项目策略状态
+     */
+    @PostMapping(value = "/updateAccountStatus")
+    public Result<Object> updateAccountStatus(@RequestBody JSONObject data) {
+        try {
+            Long accountId = data.getLong("accountId");
+            Integer projectStrategy = data.getInteger("projectStrategy");
+            if (Check.isNull(accountId) || Check.isNull(projectStrategy)) {
+                return Result.error("缺失参数");
+            }
+            boolean ok = userAllocationService.updateProjectStrategyStatus(accountId, projectStrategy);
+            if (ok) {
+                return Result.ok("修改成功!");
+            }
+        } catch (Exception e) {
+            log.error("修改异常,", e.getMessage());
+            e.printStackTrace();
+        }
+        return Result.error("修改失败");
+    }
+
+    /**
+     * 校验是否有开启的项目
+     */
+    @GetMapping(value = "/checkProjectisOpen")
+    public Result<Object> checkProjectisOpen(Long projectId) {
+        try {
+            if (Check.isNull(projectId)) {
+                return Result.error("缺失参数");
+            }
+            boolean ok = kuaishouProjectStrategyService.checkProjectisOpen(projectId);
+            if (ok) {
+                return Result.ok((Object) 1);
+            }
+        } catch (Exception e) {
+            log.error("修改异常,", e.getMessage());
+            e.printStackTrace();
+        }
+        return Result.ok((Object) 0);
+    }
+
+    /**
+     * 出价反显展示
+     */
+    @GetMapping(value = "/queryBidInfo")
+    public Result<Object> queryBidInfo(@RequestParam(name = "id", required = true) String id) {
+        Result<KuaishouProjectStrategy> result = new Result<>();
+        KuaishouProjectStrategy kuaishouProjectStrategy = kuaishouProjectStrategyService.getById(id);
+        if (kuaishouProjectStrategy == null) {
+            return Result.error("未找到对应实体");
+        } else {
+            return Result.ok(kuaishouProjectStrategy);
+        }
+    }
+
+    /**
+     * 查询项目策略匹配结果
+     */
+    @GetMapping(value = "/queryMatchResult")
+    public Result<Object> queryMatchResult(Long projectId, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
+        Result<KuaishouProjectStrategy> result = new Result<>();
+        try {
+            return kuaishouProjectStrategyService.queryMatchResult(projectId, pageNo, pageSize);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return Result.error("查询失败");
+    }
+
+
+    /**
+     * 创建项目策略
+     */
+    @PostMapping(value = "/createProjectStrategy")
+    public Result<KuaishouProjectStrategy> createProjectStrategy(@RequestBody JSONObject data) {
+        Result<KuaishouProjectStrategy> result = new Result<>();
+        try {
+            KuaishouProjectStrategy kuaishouProjectStrategy = JSONObject.parseObject(data.toJSONString(), KuaishouProjectStrategy.class);
+            kuaishouProjectStrategy.setStatDate(DateUtils.getNowDate("yyyy-MM-dd"));
+            LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+            if (!Check.isNull(user)) {
+                kuaishouProjectStrategy.setUserId(user.getId());
+            }
+            if (Check.isNull(kuaishouProjectStrategy.getId()) && !Check.isNull(kuaishouProjectStrategy.getProjectId())) {
+                QueryWrapper<UserAllocation> wrapper = new QueryWrapper<>();
+                wrapper.eq("project_id", kuaishouProjectStrategy.getProjectId());
+                wrapper.eq("account_status", 0);
+                wrapper.eq("auto_delivery", 0);
+                UserAllocation userAllocation = new UserAllocation();
+                userAllocation.setAutoDelivery(1);
+                userAllocationService.update(userAllocation, wrapper);
+            }
+            boolean b = kuaishouProjectStrategyService.saveOrUpdate(kuaishouProjectStrategy);
+            result.success("操作成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+
+
+    /**
+     * 通过id删除
+     *
+     * @param id
+     * @return
+     */
+    @ApiOperation(value = "自动投放-项目策略表-通过id删除", notes = "自动投放-项目策略表-通过id删除")
+    @DeleteMapping(value = "/delete")
+    public Result<?> delete(@RequestParam(name = "id") String id) {
+        try {
+            kuaishouProjectStrategyService.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<KuaishouProjectStrategy> deleteBatch(@RequestParam(name = "ids") String ids) {
+        Result<KuaishouProjectStrategy> result = new Result<>();
+        if (ids == null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        } else {
+            this.kuaishouProjectStrategyService.removeByIds(Arrays.asList(ids.split(",")));
+            result.success("删除成功!");
+        }
+        return result;
+    }
+
+    /**
+     * 通过id查询
+     *
+     * @param id
+     * @return
+     */
+    @ApiOperation(value = "自动投放-项目策略表-通过id查询", notes = "自动投放-项目策略表-通过id查询")
+    @GetMapping(value = "/queryById")
+    public Result<KuaishouProjectStrategy> queryById(@RequestParam(name = "id", required = true) String id) {
+        Result<KuaishouProjectStrategy> result = new Result<>();
+        KuaishouProjectStrategy kuaishouProjectStrategy = kuaishouProjectStrategyService.getById(id);
+        if (kuaishouProjectStrategy == null) {
+            result.error500("未找到对应实体");
+        } else {
+            Project project = projectService.getById(kuaishouProjectStrategy.getProjectId());
+            if (!Check.isNull(project)) {
+                kuaishouProjectStrategy.setProjectName(project.getProjectName());
+            }
+            result.setResult(kuaishouProjectStrategy);
+            result.setSuccess(true);
+        }
+        return result;
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param response
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+        // Step.1 组装查询条件
+        QueryWrapper<KuaishouProjectStrategy> queryWrapper = null;
+        try {
+            String paramsStr = request.getParameter("paramsStr");
+            if (oConvertUtils.isNotEmpty(paramsStr)) {
+                String deString = URLDecoder.decode(paramsStr, "UTF-8");
+                KuaishouProjectStrategy kuaishouProjectStrategy = JSON.parseObject(deString, KuaishouProjectStrategy.class);
+                queryWrapper = QueryGenerator.initQueryWrapper(kuaishouProjectStrategy, request.getParameterMap());
+            }
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+
+        //Step.2 AutoPoi 导出Excel
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        List<KuaishouProjectStrategy> pageList = kuaishouProjectStrategyService.list(queryWrapper);
+        //导出文件名称
+        mv.addObject(NormalExcelConstants.FILE_NAME, "自动投放-项目策略表列表");
+        mv.addObject(NormalExcelConstants.CLASS, KuaishouProjectStrategy.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<KuaishouProjectStrategy> listKuaishouProjectStrategys = ExcelImportUtil.importExcel(file.getInputStream(), KuaishouProjectStrategy.class, params);
+                kuaishouProjectStrategyService.saveBatch(listKuaishouProjectStrategys);
+                return Result.ok("文件导入成功!数据行数:" + listKuaishouProjectStrategys.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("文件导入失败!");
+    }
+
+}

+ 7 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/controller/KuaishouVideoDirectionalPackageController.java

@@ -101,6 +101,13 @@ public class KuaishouVideoDirectionalPackageController {
             if (!Check.isNull(requestJson.getJSONArray("keyword"))) {
                 directionalPackage.setKeyword(JSONObject.toJSONString(requestJson.getJSONArray("keyword")));
             }
+            if("0".equals(requestJson.getJSONObject("allForm").getString("behaviorInterest"))){
+                directionalPackage.setSceneType("[]");
+                directionalPackage.setTimeType(-1);
+                directionalPackage.setStrengthType(0);
+                directionalPackage.setLabel("[]");
+                directionalPackage.setInterestLabel("[]");
+            }
             kuaishouVideoDirectionalPackageService.saveOrUpdate(directionalPackage);
             String id = "";
             if (!Check.isNull(directionalPackage.getId())) {

+ 84 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/entity/AiKuaishouAccountLevelOperationRecord.java

@@ -0,0 +1,84 @@
+package cn.com.ctop.kuaishou.modules.ai.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+import java.util.Date;
+
+/**
+ * 智能投放-账户层级操作记录表
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2021-07-11
+ */
+@Data
+@TableName("ctop_ai_kuaishou_account_level_operation_record")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_ai_kuaishou_account_level_operation_record对象", description = "智能投放-账户层级操作记录表")
+public class AiKuaishouAccountLevelOperationRecord {
+
+    /**
+     * 账户操作表uuid
+     */
+    @TableId(type = IdType.ASSIGN_UUID)
+    @ApiModelProperty(value = "账户操作表uuid")
+    private String id;
+    /**
+     * AI策略ID
+     */
+    @Excel(name = "AI策略ID", width = 15)
+    @ApiModelProperty(value = "AI策略ID")
+    private String aiStrategyUuid;
+    /**
+     * 项目ID
+     */
+    @Excel(name = "项目ID", width = 15)
+    @ApiModelProperty(value = "项目ID")
+    private Long projectId;
+    /**
+     * 账户ID
+     */
+    @Excel(name = "账户ID", width = 15)
+    @ApiModelProperty(value = "账户ID")
+    private Long accountId;
+    /**
+     * 异常类型 1 检查错误,2创建时错误
+     */
+    @Excel(name = "错误类型", width = 15)
+    @ApiModelProperty(value = "状态")
+    private Integer errType;
+    /**
+     * 1:账户自动投放 2:项目自动投放
+     */
+    @Excel(name = "1:账户自动投放 2:项目自动投放", width = 15)
+    @ApiModelProperty(value = "1:账户自动投放 2:项目自动投放")
+    private Integer createType;
+    /**
+     * 状态详情
+     */
+    @Excel(name = "状态详情", width = 15)
+    @ApiModelProperty(value = "状态详情")
+    private String message;
+    private String statDate;
+    /**
+     * 状态
+     */
+    @Excel(name = "状态", width = 15)
+    @ApiModelProperty(value = "状态")
+    private Integer status;
+    /**
+     * 创建时间
+     */
+    @ApiModelProperty(value = "创建时间")
+    private Date createTime;
+    private Date updateTime;
+}

+ 85 - 41
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/entity/AiKuaishouCampaignLevelOperationRecord.java

@@ -9,53 +9,97 @@ import java.util.Date;
 
 /**
  * 计划创建记录
+ *
  * @author jeecg-boot
- * @date   2021-04-12
  * @version V1.0
+ * @date 2021-04-12
  */
 @Data
 @TableName("ctop_ai_kuaishou_campaign_level_operation_record")
 public class AiKuaishouCampaignLevelOperationRecord {
 
-	/**计划操作表uuid*/
-	@TableId(type = IdType.ASSIGN_UUID)
-	private String campaignUuid;
-	/**AI策略ID*/
-	private String aiStrategyUuid;
-	/**账户ID*/
-	private Long accountId;
-	/**广告计划ID*/
-	private Long campaignId;
-	/**广告计划名称*/
-	private String campaignName;
-	/**计划类型 2-提升应用安装 3-获取电商下单 4-推广品牌活动 5-收集销售线索 7-提高应用活跃*/
-	private Integer campaignType;
-	/**单日预算*/
-	private Long dayBudget;
-	/**分日预算*/
-	private String dayBudgetSchedule;
-	/**操作类型 1-新增 2-修改*/
-	private Integer operationType;
-	/**计划创建时间*/
-	private Date campaignCreateTime;
-	/**计划更新时间*/
-	private Date campaignUpdateTime;
-	/**创建时间*/
-	private Date createTime;
-	/**状态*/
-	private Integer status;
-	/**状态详情*/
-	private String message;
+    /**
+     * 计划操作表uuid
+     */
+    @TableId(type = IdType.ASSIGN_UUID)
+    private String campaignUuid;
+    /**
+     * AI策略ID
+     */
+    private String aiStrategyUuid;
+    /**
+     * 账户ID
+     */
+    private Long accountId;
+    /**
+     * 广告计划ID
+     */
+    private Long campaignId;
+    /**
+     * 广告计划名称
+     */
+    private String campaignName;
+    /**
+     * 计划类型 2-提升应用安装 3-获取电商下单 4-推广品牌活动 5-收集销售线索 7-提高应用活跃
+     */
+    private Integer campaignType;
+    /**
+     * 单日预算
+     */
+    private Long dayBudget;
+    /**
+     * 分日预算
+     */
+    private String dayBudgetSchedule;
+    /**
+     * 操作类型 1-新增 2-修改
+     */
+    private Integer operationType;
+    /**
+     * 计划创建时间
+     */
+    private Date campaignCreateTime;
+    /**
+     * 计划更新时间
+     */
+    private Date campaignUpdateTime;
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+    /**
+     * 状态
+     */
+    private Integer status;
+    /**
+     * 状态详情
+     */
+    private String message;
+    /**
+     * 1:账户自动投放 2:项目自动投放
+     */
+    private Integer createType;
 
-	public AiKuaishouCampaignLevelOperationRecord(AiKuaishouAdvertiserStrategy strategy, Long campaignId, Integer code, String message) {
-		this.accountId = strategy.getAccountId();
-		this.dayBudget = strategy.getCampaignDayBudget();
-		this.dayBudgetSchedule = strategy.getCampaignDayBudgetSchedule();
-		this.campaignType = strategy.getCampaignType();
-		this.campaignId = campaignId;
-		this.status = code;
-		this.message = message;
-		this.operationType = 1;
-		this.createTime = new Date();
-	}
+    public AiKuaishouCampaignLevelOperationRecord(AiKuaishouAdvertiserStrategy strategy, Long campaignId, Integer code, String message) {
+        this.accountId = strategy.getAccountId();
+        this.dayBudget = strategy.getCampaignDayBudget();
+        this.dayBudgetSchedule = strategy.getCampaignDayBudgetSchedule();
+        this.campaignType = strategy.getCampaignType();
+        this.campaignId = campaignId;
+        this.status = code;
+        this.message = message;
+        this.operationType = 1;
+        this.createTime = new Date();
+    }
+
+    public AiKuaishouCampaignLevelOperationRecord(KuaishouProjectStrategy strategy, Long campaignId, Integer code, String message) {
+        this.accountId = strategy.getAccountId();
+        this.dayBudget = strategy.getCampaignDayBudget();
+        this.campaignType = strategy.getCampaignType();
+        this.campaignId = campaignId;
+        this.status = code;
+        this.message = message;
+        this.operationType = 1;
+        this.createTime = new Date();
+    }
 }

+ 4 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/entity/AiKuaishouCreativeLevelOperationRecord.java

@@ -151,4 +151,8 @@ public class AiKuaishouCreativeLevelOperationRecord {
      * 状态详情
      */
     private String message;
+    /**
+     * 1:账户自动投放 2:项目自动投放
+     */
+    private Integer createType;
 }

+ 107 - 52
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/entity/AiKuaishouProgramCreativeLevelOperationRecord.java

@@ -9,63 +9,118 @@ import java.util.Date;
 
 /**
  * 程序换创意创建记录
+ *
  * @author jeecg-boot
- * @date   2021-04-12
  * @version V1.0
+ * @date 2021-04-12
  */
 @Data
 @TableName("ctop_ai_kuaishou_program_creative_level_operation_record")
 public class AiKuaishouProgramCreativeLevelOperationRecord {
 
-	/**程序化创意操作表uuid*/
-	@TableId(type = IdType.ASSIGN_UUID)
-	private String creativeUuid;
-	/**AI策略ID*/
-	private String aiStrategyUuid;
-	/**账户ID*/
-	private Integer accountId;
-	/**广告计划ID*/
-	private Integer campaignId;
-	/**广告组ID*/
-	private Integer unitId;
-	/**是否为便利贴,默认为0*/
-	private Integer isSticky;
-	/**程序化创意名称*/
-	private String packageName;
-	/**横版视频ID list*/
-	private String horizontalPhotoIds;
-	/**竖版视频ID list*/
-	private String verticalPhotoIds;
-	/**封面list image_token*/
-	private String coverImageTokens;
-	/**落地页ID*/
-	private Integer siteId;
-	/**封面贴纸*/
-	private String stickerStyles;
-	/**封面广告语*/
-	private String coverSlogans;
-	/**行动号召按钮*/
-	private String actionBar;
-	/**作品广告语*/
-	private String captions;
-	/**第三方点击检测链接*/
-	private String clickUrl;
-	/**第三方点击检测链接*/
-	private String actionbarClickUrl;
-	/**创意分类*/
-	private Integer creativeCategory;
-	/**创意标签*/
-	private String creativeTag;
-	/**状态值 1-已提交等待回调 0-创建成功 */
-	private Integer status;
-	/**状态详情*/
-	private String message;
-	/**操作类型 1-新增 2-修改*/
-	private Integer operationType;
-	/**创意创建时间*/
-	private Date creativeCreateTime;
-	/**创意更新时间*/
-	private Date creativeUpdateTime;
-	/**创建时间*/
-	private Date createTime;
+    /**
+     * 程序化创意操作表uuid
+     */
+    @TableId(type = IdType.ASSIGN_UUID)
+    private String creativeUuid;
+    /**
+     * AI策略ID
+     */
+    private String aiStrategyUuid;
+    /**
+     * 账户ID
+     */
+    private Long accountId;
+    /**
+     * 广告计划ID
+     */
+    private Long campaignId;
+    /**
+     * 广告组ID
+     */
+    private Long unitId;
+    /**
+     * 是否为便利贴,默认为0
+     */
+    private Integer isSticky;
+    /**
+     * 程序化创意名称
+     */
+    private String packageName;
+    /**
+     * 横版视频ID list
+     */
+    private String horizontalPhotoIds;
+    /**
+     * 竖版视频ID list
+     */
+    private String verticalPhotoIds;
+    /**
+     * 封面list image_token
+     */
+    private String coverImageTokens;
+    /**
+     * 落地页ID
+     */
+    private Integer siteId;
+    /**
+     * 封面贴纸
+     */
+    private String stickerStyles;
+    /**
+     * 封面广告语
+     */
+    private String coverSlogans;
+    /**
+     * 行动号召按钮
+     */
+    private String actionBar;
+    /**
+     * 作品广告语
+     */
+    private String captions;
+    /**
+     * 第三方点击检测链接
+     */
+    private String clickUrl;
+    /**
+     * 第三方点击检测链接
+     */
+    private String actionbarClickUrl;
+    /**
+     * 创意分类
+     */
+    private Integer creativeCategory;
+    /**
+     * 创意标签
+     */
+    private String creativeTag;
+    /**
+     * 状态值 1-已提交等待回调 0-创建成功
+     */
+    private Integer status;
+    /**
+     * 状态详情
+     */
+    private String message;
+    /**
+     * 操作类型 1-新增 2-修改
+     */
+    private Integer operationType;
+    /**
+     * 创意创建时间
+     */
+    private Date creativeCreateTime;
+    /**
+     * 创意更新时间
+     */
+    private Date creativeUpdateTime;
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+    /**
+     * 1:账户自动投放 2:项目自动投放
+     */
+    private Integer createType;
 }

+ 5 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/entity/AiKuaishouUnitLevelOperationRecord.java

@@ -192,6 +192,11 @@ public class AiKuaishouUnitLevelOperationRecord {
      */
     private Integer gender;
     /**
+     * 创建类型
+     * 1:账户自动投放 2:项目自动投放
+     */
+    private Integer createType;
+    /**
      * 操作系统
      */
     private Integer platformOs;

+ 13 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/entity/KuaishouAppPackageRel.java

@@ -65,6 +65,19 @@ public class KuaishouAppPackageRel {
     @ApiModelProperty(value = "快手方-应用地址")
     private String returnUrl;
 
+    /**
+     * 第三方开始播放监测链接
+     */
+    private String impressionUrl;
+    /**
+     * 第三方有效播放监测链接
+     */
+    private String adPhotoPlayedT3sUrl;
+    /**
+     * 第三方点击按钮监测链接
+     */
+    private String actionbarClickUrl;
+
     private Integer dataStatus;
 
     private String appVersion;

+ 77 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/entity/KuaishouMaterialPoolOperationRecord.java

@@ -0,0 +1,77 @@
+package cn.com.ctop.kuaishou.modules.ai.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+import java.util.Date;
+
+/**
+ * 物料池操作记录表
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2021-07-19
+ */
+@Data
+@TableName("ctop_kuaishou_material_pool_operation_record")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_kuaishou_material_pool_operation_record对象", description = "物料池操作记录表")
+public class KuaishouMaterialPoolOperationRecord {
+
+    /**
+     * id
+     */
+    @TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "id")
+    private Long id;
+    /**
+     * 项目ID
+     */
+    @Excel(name = "项目ID", width = 15)
+    @ApiModelProperty(value = "项目ID")
+    private Long projectId;
+    /**
+     * 操作人
+     */
+    @Excel(name = "操作人", width = 15)
+    @ApiModelProperty(value = "操作人")
+    private String userId;
+    /**
+     * 物料类型,1-定向,2-人群,3-应用
+     */
+    @Excel(name = "物料类型,1-定向,2-人群,3-应用", width = 15)
+    @ApiModelProperty(value = "物料类型,1-定向,2-人群,3-应用")
+    private Integer materialType;
+    /**
+     * 操作类型,add,update,delete
+     */
+    @Excel(name = "操作类型,add,update,delete", width = 15)
+    @ApiModelProperty(value = "操作类型,add,update,delete")
+    private String type;
+    /**
+     * 操作数据JSON
+     */
+    @Excel(name = "操作数据JSON", width = 15)
+    @ApiModelProperty(value = "操作数据JSON")
+    private String data;
+    //方法名
+    private String method_name;
+    /**
+     * 创建时间
+     */
+    @ApiModelProperty(value = "创建时间")
+    private Date createTime;
+    /**
+     * updateTime
+     */
+    @ApiModelProperty(value = "updateTime")
+    private Date updateTime;
+}

+ 377 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/entity/KuaishouProjectStrategy.java

@@ -0,0 +1,377 @@
+package cn.com.ctop.kuaishou.modules.ai.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+import java.util.Date;
+
+/**
+ * 自动投放-项目策略表
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2021-06-24
+ */
+@Data
+@TableName("ctop_ai_kuaishou_project_strategy")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_ai_kuaishou_project_strategy对象", description = "自动投放-项目策略表")
+public class KuaishouProjectStrategy {
+
+    /**
+     * 客户策略ID
+     */
+    @TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "客户策略ID")
+    private Long id;
+    /**
+     * 项目ID
+     */
+    @Excel(name = "项目ID", width = 15)
+    @ApiModelProperty(value = "项目ID")
+    private Long projectId;
+    /**
+     * userId
+     */
+    @Excel(name = "userId", width = 15)
+    @ApiModelProperty(value = "userId")
+    private String userId;
+    /**
+     * 策略状态 0-停用 1-使用
+     */
+    @Excel(name = "策略状态 0-停用 1-使用", width = 15)
+    @ApiModelProperty(value = "策略状态 0-停用 1-使用")
+    private Integer dataStatus;
+    /**
+     * 计划类型 2-提升应用安装 3-获取电商下单 4-推广品牌活动 5-收集销售线索 7-提高应用活跃
+     */
+    @Excel(name = "计划类型 2-提升应用安装 3-获取电商下单 4-推广品牌活动 5-收集销售线索 7-提高应用活跃", width = 15)
+    @ApiModelProperty(value = "计划类型 2-提升应用安装 3-获取电商下单 4-推广品牌活动 5-收集销售线索 7-提高应用活跃")
+    private Integer campaignType;
+    /**
+     * 计划命名规范
+     */
+    @Excel(name = "计划命名规范", width = 15)
+    @ApiModelProperty(value = "计划命名规范")
+    private String campaignName;
+
+    private Integer campaignStatus;
+
+    private String statDate;
+    /**
+     * 广告组命名规范
+     */
+    @Excel(name = "广告组命名规范", width = 15)
+    @ApiModelProperty(value = "广告组命名规范")
+    private String groupName;
+    /**
+     * -1:投放 2 暂停
+     */
+    private Integer groupStatus;
+    /**
+     * 是否开启素材挖掘
+     */
+    private Integer assetMining;
+    /**
+     * 计划单日预算
+     */
+    @Excel(name = "计划单日预算", width = 15)
+    @ApiModelProperty(value = "计划单日预算")
+    private Long campaignDayBudget;
+    /**
+     * 组单日预算
+     */
+    @Excel(name = "组单日预算", width = 15)
+    @ApiModelProperty(value = "组单日预算")
+    private Long unitDayBudget;
+    /**
+     * 单/多应用,1单应用,2多应用
+     */
+    @Excel(name = "单/多应用,1单应用,2多应用", width = 15)
+    @ApiModelProperty(value = "单/多应用,1单应用,2多应用")
+    private Integer singleAppid;
+    /**
+     * 应用ID
+     */
+    @Excel(name = "应用ID", width = 15)
+    @ApiModelProperty(value = "应用ID")
+    private Long appId;
+    /**
+     * 应用ID列表
+     */
+    @Excel(name = "应用ID列表", width = 15)
+    @ApiModelProperty(value = "应用ID列表")
+    private String appIdArray;
+    /**
+     * 定向模板id列表
+     */
+    @Excel(name = "定向模板id列表", width = 15)
+    @ApiModelProperty(value = "定向模板id列表")
+    private String templateIdArray;
+    /**
+     * 组-优先从系统应用商店下载
+     */
+    @Excel(name = "组-优先从系统应用商店下载", width = 15)
+    @ApiModelProperty(value = "组-优先从系统应用商店下载")
+    private Integer useAppMarket;
+    /**
+     * 组-应用商店列表
+     */
+    @Excel(name = "组-应用商店列表", width = 15)
+    @ApiModelProperty(value = "组-应用商店列表")
+    private String appStore;
+    /**
+     * 组-调起应用链接
+     */
+    @Excel(name = "组-调起应用链接", width = 15)
+    @ApiModelProperty(value = "组-调起应用链接")
+    private String schemaUri;
+    /**
+     * 组-优化目标 2:行为数,180:激活数;53:表单数;190: 付费;191:首日ROI;324:唤起应用...
+     */
+    @Excel(name = "组-优化目标 2:行为数,180:激活数;53:表单数;190: 付费;191:首日ROI;324:唤起应用...", width = 15)
+    @ApiModelProperty(value = "组-优化目标 2:行为数,180:激活数;53:表单数;190: 付费;191:首日ROI;324:唤起应用...")
+    private Integer ocpxActionType;
+    /**
+     * 组-转化目标ID
+     */
+    @Excel(name = "组-转化目标ID", width = 15)
+    @ApiModelProperty(value = "组-转化目标ID")
+    private Integer convertId;
+    /**
+     * 组-优化目标出价类型
+     */
+    @Excel(name = "组-优化目标出价类型", width = 15)
+    @ApiModelProperty(value = "组-优化目标出价类型")
+    private Integer bidType;
+    /**
+     * 出价
+     */
+    @Excel(name = "出价", width = 15)
+    @ApiModelProperty(value = "出价")
+    private String bid;
+    /**
+     * OCPC出价
+     */
+    @Excel(name = "OCPC出价", width = 15)
+    @ApiModelProperty(value = "OCPC出价")
+    private String cpaBid;
+    /**
+     * 组-深度转化出价
+     */
+    @Excel(name = "组-深度转化出价", width = 15)
+    @ApiModelProperty(value = "组-深度转化出价")
+    private String deepConversionBid;
+    /**
+     * 组-深度转化目标
+     */
+    @Excel(name = "组-深度转化目标", width = 15)
+    @ApiModelProperty(value = "组-深度转化目标")
+    private Long deepConversionType;
+    /**
+     * 组-优先低成本出价
+     */
+    @Excel(name = "组-优先低成本出价", width = 15)
+    @ApiModelProperty(value = "组-优先低成本出价")
+    private Long smartBid;
+    /**
+     * 组-付费ROI系数
+     */
+    @Excel(name = "组-付费ROI系数", width = 15)
+    @ApiModelProperty(value = "组-付费ROI系数")
+    private Float roiRatio;
+    /**
+     * 组-投放开始时间
+     */
+    @Excel(name = "组-投放开始时间", width = 15)
+    @ApiModelProperty(value = "组-投放开始时间")
+    private String beginTime;
+    /**
+     * 组-投放结束时间
+     */
+    @Excel(name = "组-投放结束时间", width = 15)
+    @ApiModelProperty(value = "组-投放结束时间")
+    private String endTime;
+    /**
+     * 组-投放时间段
+     */
+    @Excel(name = "组-投放时间段", width = 15)
+    @ApiModelProperty(value = "组-投放时间段")
+    private String scheduleTime;
+    /**
+     * url类型 当计划类型为:3(获取电商下单)时必填:1 - 淘宝商品短链;2 - 淘宝商品itemID;4 - 金牛电商
+     */
+    @Excel(name = "url类型 当计划类型为:3(获取电商下单)时必填:1 - 淘宝商品短链;2 - 淘宝商品itemID;4 - 金牛电商", width = 15)
+    @ApiModelProperty(value = "url类型 当计划类型为:3(获取电商下单)时必填:1 - 淘宝商品短链;2 - 淘宝商品itemID;4 - 金牛电商")
+    private Integer urlType;
+    /**
+     * 当计划类型为5(收集销售线索)&使用建站时必填:需使用魔力建站;不传默认1,2:落地页
+     */
+    @Excel(name = "当计划类型为5(收集销售线索)&使用建站时必填:需使用魔力建站;不传默认1,2:落地页", width = 15)
+    @ApiModelProperty(value = "当计划类型为5(收集销售线索)&使用建站时必填:需使用魔力建站;不传默认1,2:落地页")
+    private Integer webUriType;
+    /**
+     * 投放链接
+     */
+    @Excel(name = "投放链接", width = 15)
+    @ApiModelProperty(value = "投放链接")
+    private String url;
+    /**
+     * 组-创意展现方式 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;
+    /**
+     * 创意制作方式,0-不限,4-自定义,7-程序化创意2.0
+     */
+    @Excel(name = " 创意制作方式,0-不限,4-自定义,7-程序化创意2.0", width = 15)
+    @ApiModelProperty(value = " 创意制作方式,0-不限,4-自定义,7-程序化创意2.0")
+    private Integer unitType;
+    /**
+     * 广告位;1:优选,3:视频播放页,5:联盟,6:上下滑
+     */
+    @Excel(name = "广告位;1:优选,3:视频播放页,5:联盟,6:上下滑", width = 15)
+    @ApiModelProperty(value = "广告位;1:优选,3:视频播放页,5:联盟,6:上下滑")
+    private String sceneId;
+    /**
+     * 关联封面数
+     */
+    @Excel(name = "关联封面数", width = 15)
+    @ApiModelProperty(value = "关联封面数")
+    private Integer imageCnt;
+    /**
+     * 自定义组数,最多400
+     */
+    @Excel(name = "自定义组数,最多400", width = 15)
+    @ApiModelProperty(value = "自定义组数,最多400")
+    private Integer customUnitCnt;
+    /**
+     * 程序化组数,最多60
+     */
+    @Excel(name = "程序化组数,最多60", width = 15)
+    @ApiModelProperty(value = "程序化组数,最多60")
+    private Integer programUnitCnt;
+    /**
+     * 素材类型 2-不限,0-内部,1-素造
+     */
+    @Excel(name = "素材类型 2-不限,0-内部,1-素造", width = 15)
+    @ApiModelProperty(value = "素材类型 2-不限,0-内部,1-素造")
+    private Integer channelType;
+    /**
+     * 智能抽帧
+     */
+    @Excel(name = "智能抽帧", width = 15)
+    @ApiModelProperty(value = "智能抽帧")
+    private Integer smartCover;
+    /**
+     * 行动号召
+     */
+    @Excel(name = "行动号召", width = 15)
+    @ApiModelProperty(value = "行动号召")
+    private String actionBarText;
+    /**
+     * 广告语
+     */
+    @Excel(name = "广告语", width = 15)
+    @ApiModelProperty(value = "广告语")
+    private String description;
+
+    private String stickerTitle;
+
+    private String overlayType;
+
+    private String exposeTag;
+
+    private String newExposeTag;
+    /**
+     * 创意分类
+     */
+    @Excel(name = "创意分类", width = 15)
+    @ApiModelProperty(value = "创意分类")
+    private Integer creativeCategory;
+    //安卓下载中间页ID
+    private Integer siteId;
+    /**
+     * 创意标签
+     */
+    @Excel(name = "创意标签", width = 15)
+    @ApiModelProperty(value = "创意标签")
+    private String creativeTag;
+    /**
+     * 创意-第三方点击检测链接
+     */
+    @Excel(name = "创意-第三方点击检测链接", width = 15)
+    @ApiModelProperty(value = "创意-第三方点击检测链接")
+    private String clickTrackUrl;
+    /**
+     * 创意-第三方开始播放监测链接
+     */
+    @Excel(name = "创意-第三方开始播放监测链接", width = 15)
+    @ApiModelProperty(value = "创意-第三方开始播放监测链接")
+    private String impressionUrl;
+    /**
+     * 创意-第三方有效播放监测链接
+     */
+    @Excel(name = "创意-第三方有效播放监测链接", width = 15)
+    @ApiModelProperty(value = "创意-第三方有效播放监测链接")
+    private String adPhotoPlayedT3sUrl;
+    /**
+     * 创意-第三方点击按钮监测链接
+     */
+    @Excel(name = "创意-第三方点击按钮监测链接", width = 15)
+    @ApiModelProperty(value = "创意-第三方点击按钮监测链接")
+    private String actionbarClickUrl;
+    /**
+     * 素材来源 1-上限素材,2-高质量素材,3-遗漏素材,4-历史打捞
+     */
+    @Excel(name = "素材来源 1-上限素材,2-高质量素材,3-遗漏素材,4-历史打捞", width = 15)
+    @ApiModelProperty(value = "素材来源 1-上限素材,2-高质量素材,3-遗漏素材,4-历史打捞")
+    private String sourceMaterial;
+    /**
+     * 定时执行生效时间
+     */
+    @ApiModelProperty(value = "定时执行生效时间")
+    private Date effectiveTime;
+    /**
+     * 定时执行失效时间
+     */
+    @ApiModelProperty(value = "定时执行失效时间")
+    private Date expiryTime;
+    /**
+     * 创建时间
+     */
+    @ApiModelProperty(value = "创建时间")
+    private Date createTime;
+    /**
+     * updateTime
+     */
+    @ApiModelProperty(value = "updateTime")
+    private Date updateTime;
+
+    @TableField(exist = false)
+    private Long accountId;
+
+    @TableField(exist = false)
+    private String strategyUuid;
+    @TableField(exist = false)
+    private Long campaignId;
+    @TableField(exist = false)
+    private String projectName;
+
+}

+ 101 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/enums/KuaishouProjectCreativeMatTypeEnum.java

@@ -0,0 +1,101 @@
+package cn.com.ctop.kuaishou.modules.ai.enums;
+
+/**
+ * @author syh
+ */
+public enum KuaishouProjectCreativeMatTypeEnum {
+    /**
+     * 13 23 分别是历史遗漏素材,归类到上新素材中
+     * type字段 第一位创意创建方式,第二位素材获取方式
+     * 快手创意素材获取类型
+     */
+    KUAISHOU_CREATIVE_MAT_TYPE_ENUM_CUSTOM_NEW("41","自定义上新",-20L,-10L),
+    KUAISHOU_CREATIVE_MAT_TYPE_ENUM_CUSTOM_HIGH_quality("42","自定义高质量",-28*60*24L,-1*60*24L),
+    KUAISHOU_CREATIVE_MAT_TYPE_ENUM_CUSTOM_MISSING("43","自定义上新",-60*60*24L,-1*60*24L),
+    KUAISHOU_CREATIVE_MAT_TYPE_ENUM_CUSTOM_HISTORY("44","自定义历史",-60*60*24L,-1*60*24L),
+    KUAISHOU_CREATIVE_MAT_TYPE_ENUM_PROGRAM_NEW("71","程序化上新",-3*60*24L,-5L),
+    KUAISHOU_CREATIVE_MAT_TYPE_ENUM_PROGRAM_HIGH_quality("72","程序化高质量",-28*60*24L,-1*60*24L),
+    KUAISHOU_CREATIVE_MAT_TYPE_ENUM_PROGRAM_MISSING("73","程序化上新",-60*60*24L,-1*60*24L),
+    KUAISHOU_CREATIVE_MAT_TYPE_ENUM_PROGRAM_HISTORY("74","程序化历史",-60*60*24L,-1*60*24L),;
+
+    /**
+     * 类型
+     */
+    private String type;
+    /**
+     * 名称
+     */
+    private String name;
+    /**
+     * 素材查询的时间区间
+     */
+    private Long videoGetStartTime;
+    private Long videoGetEndTime;
+
+    KuaishouProjectCreativeMatTypeEnum(String type, String name, Long videoGetStartTime, Long videoGetEndTime) {
+        this.type = type;
+        this.name = name;
+        this.videoGetStartTime = videoGetStartTime;
+        this.videoGetEndTime = videoGetEndTime;
+    }
+
+    public static String getNameByType(String type) {
+        for (KuaishouProjectCreativeMatTypeEnum createTypeEnum : KuaishouProjectCreativeMatTypeEnum.values()) {
+            if (createTypeEnum.getType().equals(type)) {
+                return createTypeEnum.getName();
+            }
+        }
+        return "";
+    }
+
+    public static Long getStartTimeByType(String type) {
+        for (KuaishouProjectCreativeMatTypeEnum createTypeEnum : KuaishouProjectCreativeMatTypeEnum.values()) {
+            if (createTypeEnum.getType().equals(type)) {
+                return createTypeEnum.getVideoGetStartTime();
+            }
+        }
+        return -10L;
+    }
+
+    public static Long getEndTimeByType(String type) {
+        for (KuaishouProjectCreativeMatTypeEnum createTypeEnum : KuaishouProjectCreativeMatTypeEnum.values()) {
+            if (createTypeEnum.getType().equals(type)) {
+                return createTypeEnum.getVideoGetEndTime();
+            }
+        }
+        return -5L;
+    }
+
+
+    public String getType() {
+        return this.type;
+    }
+
+    public String getName() {
+        return this.name;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    public void setName(String value) {
+        this.name = value;
+    }
+
+    public Long getVideoGetStartTime() {
+        return videoGetStartTime;
+    }
+
+    public void setVideoGetStartTime(Long videoGetStartTime) {
+        this.videoGetStartTime = videoGetStartTime;
+    }
+
+    public Long getVideoGetEndTime() {
+        return videoGetEndTime;
+    }
+
+    public void setVideoGetEndTime(Long videoGetEndTime) {
+        this.videoGetEndTime = videoGetEndTime;
+    }
+}

+ 20 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/AiKuaishouAccountLevelOperationRecordMapper.java

@@ -0,0 +1,20 @@
+package cn.com.ctop.kuaishou.modules.ai.mapper;
+
+import cn.com.ctop.kuaishou.modules.ai.entity.AiKuaishouAccountLevelOperationRecord;
+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-11
+ * @version V1.0
+ */
+public interface AiKuaishouAccountLevelOperationRecordMapper extends BaseMapper<AiKuaishouAccountLevelOperationRecord> {
+
+    List<JSONObject> queryMatchResult(@Param("projectId") Long projectId);
+}

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

@@ -29,4 +29,6 @@ public interface KuaishouAppPackageMapper extends BaseMapper<KuaishouAppPackage>
     List<JSONObject> getRelatedGroups(@Param("id") Long id, @Param("accountId") Long accountId);
 
     String getUrlByMd5(@Param("md5") String md5);
+
+    List<KuaishouAppPackage> getProjectAppList(@Param("projectId") Long projectId);
 }

+ 4 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/KuaishouAppPackageRelMapper.java

@@ -26,4 +26,8 @@ public interface KuaishouAppPackageRelMapper extends BaseMapper<KuaishouAppPacka
     List<JSONObject> getRelatedAccounts(@Param("id") Long id);
 
     List<JSONObject> getAccountByProjectId(@Param("projectId") Long projectId, @Param("id") String id);
+
+    List<JSONObject> getAppsDetail(@Param("ids") List<Long> ids);
+
+    JSONObject queryAppId(@Param("appTemId") Long appTemId, @Param("accountId") Long accountId);
 }

+ 4 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/KuaishouDirectionalPackageMapper.java

@@ -25,4 +25,8 @@ public interface KuaishouDirectionalPackageMapper extends BaseMapper<KuaishouDir
     List<JSONObject> getRelatedAccount(@Param("id") String id);
 
     List getRelatedGroup(@Param("id") String id, @Param("accountId") Long accountId);
+
+    List<KuaishouDirectionalPackage> queryListByProjectId(@Param("projectId") Long projectId, @Param("templateName") String templateName);
+
+    List<KuaishouDirectionalPackage> getProjectTargetByIds(@Param("ids") List<String> ids);
 }

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

@@ -28,4 +28,6 @@ public interface KuaishouDirectionalPckageRelMapper extends BaseMapper<KuaishouD
     List<JSONObject> queryUnitIdByAccountId(@Param("id") String id, @Param("accountId") Long accountId);
 
     void updateTemName(@Param("id") String id, @Param("templateName") String templateName);
+
+    Long selectTemplateId(@Param("dirId") String id,@Param("accountId")Long accountId);
 }

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

@@ -0,0 +1,17 @@
+package cn.com.ctop.kuaishou.modules.ai.mapper;
+
+import java.util.List;
+
+import cn.com.ctop.kuaishou.modules.ai.entity.KuaishouMaterialPoolOperationRecord;
+import org.apache.ibatis.annotations.Param;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 物料池操作记录表
+ * @author jeecg-boot
+ * 2021-07-19
+ * @version V1.0
+ */
+public interface KuaishouMaterialPoolOperationRecordMapper extends BaseMapper<KuaishouMaterialPoolOperationRecord> {
+
+}

+ 32 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/KuaishouProjectStrategyMapper.java

@@ -0,0 +1,32 @@
+package cn.com.ctop.kuaishou.modules.ai.mapper;
+
+import cn.com.ctop.kuaishou.modules.ai.entity.KuaishouProjectStrategy;
+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-06-24
+ * @version V1.0
+ */
+public interface KuaishouProjectStrategyMapper extends BaseMapper<KuaishouProjectStrategy> {
+
+    List<JSONObject> queryProjectList(JSONObject data);
+
+    List<JSONObject> queryAccountList(JSONObject data);
+
+    JSONObject queryProjectAll(JSONObject data);
+
+    JSONObject queryAccountAll(JSONObject data);
+
+    Integer checkProjectisOpen(Long projectId);
+
+    List<KuaishouProjectStrategy> getAllEffectStrategy(@Param("unitType")int unitType, @Param("sourceMaterial")String sourceMaterial);
+
+    List<Long> queryProjectId();
+}

+ 17 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/xml/AiKuaishouAccountLevelOperationRecordMapper.xml

@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="cn.com.ctop.kuaishou.modules.ai.mapper.AiKuaishouAccountLevelOperationRecordMapper">
+
+    <select id="queryMatchResult" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+            t1.account_id as 'accountId',
+            t1.message as 'resultText',
+            t1.`status` as 'authStatus',
+            t2.auth_name as 'authName'
+        FROM
+            ctop_ai_kuaishou_account_level_operation_record t1
+                LEFT JOIN ctop_user_allocation t2 ON t1.account_id = t2.account_id
+        where t1.project_id = #{projectId}
+        and stat_date = DATE_FORMAT(now(), '%Y-%m-%d')
+    </select>
+</mapper>

+ 14 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/xml/KuaishouAppPackageMapper.xml

@@ -133,4 +133,18 @@
         WHERE image_md5 = #{md5} limit 1
     </select>
 
+    <select id="getProjectAppList" resultType="cn.com.ctop.kuaishou.modules.ai.entity.KuaishouAppPackage">
+        SELECT
+            t1.id,
+            t1.project_id,
+            CONCAT(app_name,'(',CASE  WHEN platform=1 OR platform=2 then 'Android' else 'iOS' END ,')') as 'appName',
+            t1.platform
+        FROM ctop_kuaishou_app_package t1
+                 LEFT JOIN ctop_kuaishou_app_package_rel t2 ON t1.id = t2.apptem_id
+        WHERE t1.data_status = 1
+          AND t1.project_id = #{projectId}
+          and t2.data_status = 1
+        GROUP BY t1.id
+    </select>
+
 </mapper>

+ 31 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/xml/KuaishouAppPackageRelMapper.xml

@@ -92,4 +92,35 @@
           AND t1.project_id = #{projectId}
     </select>
 
+    <select id="queryAppId" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT app_id,impression_url,actionbar_click_url,ad_photo_played_t3s_url,t2.track_url FROM  ctop_kuaishou_app_package_rel t1
+        LEFT JOIN ctop_kuaishou_app_package t2 ON t2.id = t1.apptem_id
+        where t1.data_status = 1
+        AND t1.account_id = #{accountId}
+        AND t1.apptem_id = #{appTemId}
+    </select>
+
+    <select id="getAppsDetail" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+            apptem_id as 'apptemId',
+            t2.id,
+            t1.project_id as 'projectId',
+            t1.app_name as 'appName',
+            IFNULL(t1.track_url, '') as 'tracUrl',
+            t1.platform ,
+            t2.app_version as 'appVersion',
+            IFNULL(t2.impression_url, '') as 'impressionUrl',
+            IFNULL(t2.actionbar_click_url, '') as 'actionbarClickUrl',
+            IFNULL(t2.ad_photo_played_t3s_url, '') as 'adPhotoPlayedT3sUrl',
+            t2.app_id as 'appId',
+            (SELECT COUNT(1) FROM ctop_kuaishou_app_package_rel WHERE apptem_id = t2.apptem_id AND data_status = 1) as 'count'
+        FROM ctop_kuaishou_app_package t1
+                LEFT JOIN ctop_kuaishou_app_package_rel t2 ON t1.id = t2.apptem_id
+        WHERE t2.data_status = 1
+          AND apptem_id in
+        <foreach collection="ids" item="ids" separator="," open="(" close=")">
+            #{ids}
+        </foreach>
+    </select>
+
 </mapper>

+ 20 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/xml/KuaishouDirectionalPackageMapper.xml

@@ -109,4 +109,24 @@
         LEFT JOIN ctop_user_allocation t3 ON t1.account_id = t3.account_id
         WHERE t2.rel_type = 'unit' AND t2.dir_id =#{id}
     </select>
+
+    <select id="queryListByProjectId" resultType="cn.com.ctop.kuaishou.modules.ai.entity.KuaishouDirectionalPackage">
+        SELECT *
+        FROM ctop_kuaishou_directional_package
+        WHERE data_status = 1
+        and project_id = #{projectId}
+        <if test="templateName !=null">
+            and template_name like concat('%',#{templateName},'%')
+        </if>
+    </select>
+
+    <select id="getProjectTargetByIds" resultType="cn.com.ctop.kuaishou.modules.ai.entity.KuaishouDirectionalPackage">
+        SELECT *
+        FROM ctop_kuaishou_directional_package
+        WHERE data_status = 1
+        and id in
+        <foreach collection="ids" item="ids" separator="," open="(" close=")">
+            #{ids}
+        </foreach>
+    </select>
 </mapper>

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

@@ -93,6 +93,15 @@
           AND t2.dir_id = #{id}
     </select>
 
+    <select id="selectTemplateId" resultType="java.lang.Long">
+        SELECT template_id
+        FROM ctop_kuaishou_directional_package_rel
+        WHERE rel_type = 'account'
+        AND dir_id = #{dirId}
+        AND rel_id =#{accountId}
+        and data_status = 1
+    </select>
+
     <update id="updateTemName">
         update
             ctop_kuaishou_directional_package_rel

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

+ 200 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/xml/KuaishouProjectStrategyMapper.xml

@@ -0,0 +1,200 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="cn.com.ctop.kuaishou.modules.ai.mapper.KuaishouProjectStrategyMapper">
+
+    <select id="queryProjectList" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT t1.*,
+               (SELECT COUNT(1) FROM ctop_user_allocation WHERE account_status = 0 and t1.projectId = project_id) as 'allAccountCount',
+               (SELECT COUNT(1) FROM ctop_user_allocation WHERE account_status = 0 and t1.projectId = project_id and auto_delivery = 1) as 'successCount',
+               IFNULL(SUM(t2.charge),0) as 'charge',
+               IFNULL(SUM(t2.photo_show),0) as 'photoShow',
+               IFNULL(SUM(t2.photo_click),0) as 'photoClick',
+               IFNULL(SUM(t2.aclick),0) as 'aclick',
+               IFNULL(SUM(t2.bclick),0) as 'bclick',
+               CONCAT(CAST(IFNULL(ROUND(SUM(t2.photo_click)/SUM(t2.photo_show)*100,2),0)as CHAR),'%') as 'photoClickRatio',
+               CONCAT(CAST(IFNULL(ROUND(SUM(t2.bclick)/SUM(t2.aclick)*100,2),0)as CHAR),'%') as 'actionRatio',
+               IFNULL(ROUND(SUM(t2.charge)/SUM(t2.aclick)*1000,2),0) as 'impression1kCost',
+               IFNULL(ROUND(SUM(t2.charge)/SUM(t2.photo_click),2),0) as 'photoClickCost',
+               IFNULL(ROUND(SUM(t2.charge)/SUM(t2.bclick),2),0) as 'actionCost'
+        FROM
+            (
+                SELECT
+                    k1.id,
+                    k1.data_status as 'dataStatus',
+                    k1.project_id as 'projectId',
+                    k3.project_name as 'projectName',
+                    (SELECT realname FROM sys_user WHERE k3.responsible_id = id) as 'responsibleName',
+                    k1.stat_date as 'statDate',
+                    k2.account_id as 'accountId',
+                    k1.create_time as 'createTime'
+                FROM ctop_ai_kuaishou_project_strategy k1
+                         LEFT JOIN ctop_user_allocation k2 ON k1.project_id = k2.project_id
+                         LEFT JOIN ctop_project k3 ON k1.project_id = k3.id
+                where k3.media_id=2 and k2.auto_delivery != 3
+                    <if test="projectId != null ">
+                    and  k1.project_id = #{projectId}
+                    </if>
+                  <if test="dataStatus != null ">
+                    and  k1.data_status = #{dataStatus}
+                    </if>
+                    <if test="userId != null ">
+                     and k3.responsible_id = #{userId}
+                    </if>
+            ) t1
+                LEFT JOIN ctop_etl_kuaishou_report_account_daily t2 ON t2.account_id = t1.accountId
+        and t2.stat_date &gt;=#{startTime}
+        and t2.stat_date &lt;=#{endTime}
+        GROUP BY t1.id
+        <if test="sortCode != '' and sortCode != null ">
+            ORDER BY ${sortCode} ${sortType}
+        </if>
+    </select>
+
+    <select id="queryAccountList" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+            IFNULL(t1.auth_name,'') as 'authName',
+            IFNULL(t1.account_id,'') as 'accountId',
+            IFNULL(t1.auto_delivery,0) as 'projectStrategy',
+            IFNULL(t3.project_name,'') as 'projectName',
+            IFNULL(SUM(t2.charge),0) as 'charge',
+            IFNULL(SUM(t2.photo_show),0) as 'photoShow',
+            IFNULL(SUM(t2.photo_click),0) as 'photoClick',
+            IFNULL(SUM(t2.aclick),0) as 'aclick',
+            IFNULL(SUM(t2.bclick),0) as 'bclick',
+            CONCAT(CAST(IFNULL(ROUND(SUM(t2.photo_click)/SUM(t2.photo_show)*100,2),0)as CHAR),'%') as 'photoClickRatio',
+            CONCAT(CAST(IFNULL(ROUND(SUM(t2.bclick)/SUM(t2.aclick)*100,2),0)as CHAR),'%') as 'actionRatio',
+            IFNULL(ROUND(SUM(t2.charge)/SUM(t2.aclick)*1000,2),0) as 'impression1kCost',
+            IFNULL(ROUND(SUM(t2.charge)/SUM(t2.photo_click),2),0) as 'photoClickCost',
+            IFNULL(ROUND(SUM(t2.charge)/SUM(t2.bclick),2),0) as 'actionCost',
+            (SELECT IFNULL(MIN(stat_date),'') FROM ctop_kuaishou_report_daily_account where account_id = t1.account_id AND charge >0) as 'statDate'
+        FROM ctop_user_allocation t1
+                 LEFT JOIN ctop_etl_kuaishou_report_account_daily t2 ON t2.account_id = t1.account_id
+                and t2.stat_date &gt;=#{startTime}
+                and t2.stat_date &lt;=#{endTime}
+                 LEFT JOIN ctop_project t3 ON t1.project_id = t3.id
+        where t1.auto_delivery != 3 AND account_status = 0
+        <if test="projectIds != null and projectIds.size()>0 ">
+            AND t1.project_id in
+            <foreach collection="projectIds" item="item" separator=","
+                     open="(" close=")">
+                #{item}
+            </foreach>
+        </if>
+          <if test="authName != null ">
+              and  t1.auth_name LIKE CONCAT('%',#{authName},'%')
+        </if>
+        GROUP BY t1.account_id
+        <if test="sortCode != '' and sortCode != null ">
+            ORDER BY ${sortCode} ${sortType}
+        </if>
+    </select>
+
+    <select id="queryAccountAll" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+            '-' as 'authName',
+            IFNULL(t1.account_id,'') as 'accountId',
+            IFNULL(t1.project_strategy,0) as 'projectStrategy',
+            '-' as 'projectName',
+            IFNULL(SUM(t2.charge),0) as 'charge',
+            IFNULL(SUM(t2.photo_show),0) as 'photoShow',
+            IFNULL(SUM(t2.photo_click),0) as 'photoClick',
+            IFNULL(SUM(t2.aclick),0) as 'aclick',
+            IFNULL(SUM(t2.bclick),0) as 'bclick',
+            CONCAT(CAST(IFNULL(ROUND(SUM(t2.photo_click)/SUM(t2.photo_show)*100,2),0)as CHAR),'%') as 'photoClickRatio',
+            CONCAT(CAST(IFNULL(ROUND(SUM(t2.bclick)/SUM(t2.aclick)*100,2),0)as CHAR),'%') as 'actionRatio',
+            IFNULL(ROUND(SUM(t2.charge)/SUM(t2.aclick)*1000,2),0) as 'impression1kCost',
+            IFNULL(ROUND(SUM(t2.charge)/SUM(t2.photo_click),2),0) as 'photoClickCost',
+            IFNULL(ROUND(SUM(t2.charge)/SUM(t2.bclick),2),0) as 'actionCost'
+        FROM ctop_user_allocation t1
+                 LEFT JOIN ctop_etl_kuaishou_report_account_daily t2 ON t2.account_id = t1.account_id
+                 LEFT JOIN ctop_project t3 ON t1.project_id = t3.id
+        where t1.auto_delivery != 3
+          and t2.stat_date &gt;=#{startTime}
+          and t2.stat_date &lt;=#{endTime}
+        <if test="projectIds != null and projectIds.size()>0 ">
+            AND t1.project_id in
+            <foreach collection="projectIds" item="item" separator=","
+                     open="(" close=")">
+                #{item}
+            </foreach>
+        </if>
+          <if test="authName != null ">
+              and  t1.auth_name LIKE CONCAT('%',#{authName},'%')
+        </if>
+    </select>
+
+    <select id="queryProjectAll" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+            '-' as 'authName',
+            IFNULL(t1.account_id,'') as 'accountId',
+            IFNULL(t1.project_strategy,0) as 'projectStrategy',
+            '-' as 'projectName',
+            IFNULL(SUM(t2.charge),0) as 'charge',
+            IFNULL(SUM(t2.photo_show),0) as 'photoShow',
+            IFNULL(SUM(t2.photo_click),0) as 'photoClick',
+            IFNULL(SUM(t2.aclick),0) as 'aclick',
+            IFNULL(SUM(t2.bclick),0) as 'bclick',
+            CONCAT(CAST(IFNULL(ROUND(SUM(t2.photo_click)/SUM(t2.photo_show)*100,2),0)as CHAR),'%') as 'photoClickRatio',
+            CONCAT(CAST(IFNULL(ROUND(SUM(t2.bclick)/SUM(t2.aclick)*100,2),0)as CHAR),'%') as 'actionRatio',
+            IFNULL(ROUND(SUM(t2.charge)/SUM(t2.aclick)*1000,2),0) as 'impression1kCost',
+            IFNULL(ROUND(SUM(t2.charge)/SUM(t2.photo_click),2),0) as 'photoClickCost',
+            IFNULL(ROUND(SUM(t2.charge)/SUM(t2.bclick),2),0) as 'actionCost',
+            (SELECT COUNT(1) FROM ctop_user_allocation where auto_delivery = 1 AND account_status = 0
+            <if test="projectIds != null and projectIds.size()>0 ">
+                 AND project_id in
+                <foreach collection="projectIds" item="item" separator=","
+                         open="(" close=")">
+                    #{item}
+                </foreach>
+            </if>
+            ) as 'successCount',
+            (SELECT COUNT(1) FROM ctop_user_allocation where account_status = 0
+            <if test="projectIds != null and projectIds.size()>0 ">
+            AND project_id in
+            <foreach collection="projectIds" item="item" separator=","
+                     open="(" close=")">
+                #{item}
+            </foreach>
+            </if>
+            ) as 'allAccountCount'
+        FROM ctop_user_allocation t1
+                 LEFT JOIN ctop_etl_kuaishou_report_account_daily t2 ON t2.account_id = t1.account_id and t2.stat_date &gt;=#{startTime}
+                 and t2.stat_date &lt;=#{endTime}
+                 LEFT JOIN ctop_project t3 ON t1.project_id = t3.id
+        where t1.auto_delivery != 3
+        <if test="projectIds != null and projectIds.size()>0 ">
+            and t1.project_id in
+            <foreach collection="projectIds" item="item" separator=","
+                     open="(" close=")">
+                #{item}
+            </foreach>
+        </if>
+          <if test="userId != null ">
+              and  t3.responsible_id =#{userId}
+        </if>
+    </select>
+
+
+    <select id="checkProjectisOpen" resultType="java.lang.Integer">
+        SELECT COUNT(1) FROM ctop_ai_kuaishou_project_strategy WHERE data_status = 1
+        AND project_id = #{projectId}
+        LIMIT 1
+    </select>
+
+    <select id="getAllEffectStrategy" resultType="cn.com.ctop.kuaishou.modules.ai.entity.KuaishouProjectStrategy">
+        SELECT id, project_id from ctop_ai_kuaishou_project_strategy
+        WHERE data_status = 1
+        <if test="unitType != null ">
+          AND (unit_type = #{unitType} OR unit_type = 0)
+        </if>
+        <if test="sourceMaterial != null ">
+          AND LOCATE(#{sourceMaterial},source_material)
+        </if>
+    </select>
+
+    <select id="queryProjectId" resultType="java.lang.Long">
+        SELECT project_id from ctop_ai_kuaishou_project_strategy
+        group by project_id
+    </select>
+
+</mapper>

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

@@ -0,0 +1,15 @@
+package cn.com.ctop.kuaishou.modules.ai.service;
+
+import cn.com.ctop.kuaishou.modules.ai.entity.AiKuaishouAccountLevelOperationRecord;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * 智能投放-账户层级操作记录表
+ *
+ * @author jeecg-boot
+ * 2021-07-11
+ * @version V1.0
+ */
+public interface IAiKuaishouAccountLevelOperationRecordService extends IService<AiKuaishouAccountLevelOperationRecord> {
+
+}

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

@@ -0,0 +1,19 @@
+package cn.com.ctop.kuaishou.modules.ai.service;
+
+import cn.com.ctop.kuaishou.modules.ai.entity.AiKuaishouAdvertiserStrategy;
+import cn.com.ctop.kuaishou.modules.ai.entity.KuaishouProjectStrategy;
+
+import java.text.ParseException;
+
+public interface IAiKuaishouProjectCreateCreativeService {
+
+    void customCreativeSupplement(KuaishouProjectStrategy strategy, Integer hour) throws ParseException;
+
+    void projectAutomaticCreates(KuaishouProjectStrategy strategy);
+
+    void projectAutomaticCreates(KuaishouProjectStrategy strategy,Integer operationType);
+    // 组创建是否超限
+    Boolean getUnitOverrun(String keyx);
+
+    void projectProgramAutomaticCreates(KuaishouProjectStrategy strategy,Integer type);
+}

+ 7 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/IKuaishouAppPackageService.java

@@ -19,7 +19,7 @@ public interface IKuaishouAppPackageService extends IService<KuaishouAppPackage>
 
     Result<Object> importExcel(MultipartFile file, Long projectId, Integer platform, String imageUrl) throws Exception;
 
-    Result<Object> pushAppPackage(Long id, JSONArray accountIds);
+    Result<Object> pushAppPackage(Long id, JSONArray accountIds,JSONObject requestJson);
 
     Result<Object> queryPushResults(String id, JSONArray accountIds, String status);
 
@@ -36,4 +36,10 @@ public interface IKuaishouAppPackageService extends IService<KuaishouAppPackage>
     Result<Object> getAccountByProjectId(Long projectId, String id);
 
     String getDownloadPath(String url);
+
+    Result<Object> getProjectAppList(Long projectId);
+
+    Result<Object> getAppsDetail(List<Long> list);
+
+    JSONObject queryAppId(Long appTemId, Long accountId);
 }

+ 11 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/IKuaishouDirectionalPackageService.java

@@ -6,6 +6,8 @@ import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.service.IService;
 import org.jeecg.common.api.vo.Result;
 
+import java.util.List;
+
 /**
  * @Description: 自动投放-定向包详情
  * @Author: jeecg-boot
@@ -22,7 +24,9 @@ public interface IKuaishouDirectionalPackageService extends IService<KuaishouDir
 
     Result<Object> getRelatedAccountGroup(String id, Integer type,Long accountId, Integer pageNo, Integer pageSize);
 
-    Result<Object> pushDirectionalPackage(String id, JSONArray datas);
+    Result<Object> pushDirectionalPackage(String id, JSONArray datas,JSONObject requestJson);
+
+    void createDirectionalPackage2(JSONObject data, JSONObject request);
 
     Result<Object> queryPushResults(String id, JSONArray accountIds,String status);
 
@@ -45,4 +49,10 @@ public interface IKuaishouDirectionalPackageService extends IService<KuaishouDir
     void createUnitAndTemplate(JSONObject request) throws Exception;
 
     Result<Object> queryPopulationById(Long templateId, Long accountId);
+
+    Result<Object> getProjectTarget(Long projectId, String templateName,Integer pageNo, Integer pageSize);
+
+    List<KuaishouDirectionalPackage> getProjectTargetByIds(List<String> list);
+
+    Long selectTemplateId(String id, Long accountId);
 }

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

@@ -0,0 +1,18 @@
+package cn.com.ctop.kuaishou.modules.ai.service;
+
+import cn.com.ctop.kuaishou.modules.ai.entity.KuaishouMaterialPoolOperationRecord;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * 物料池操作记录表
+ *
+ * @author jeecg-boot
+ * 2021-07-19
+ * @version V1.0
+ */
+public interface IKuaishouMaterialPoolOperationRecordService extends IService<KuaishouMaterialPoolOperationRecord> {
+
+    void addRecord(JSONObject data, String methodName, Integer materialType, String type);
+
+}

+ 1 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/IKuaishouPopulationPackageService.java

@@ -17,7 +17,7 @@ public interface IKuaishouPopulationPackageService extends IService<KuaishouPopu
 
     Result<Object> createEntity(KuaishouPopulationPackage kuaishouPopulationPackage);
 
-    Result<Object> push(JSONArray accountIds, Long id);
+    Result<Object> push(JSONArray accountIds, Long id,JSONObject request);
 
     Result<Object> queryPageList(KuaishouPopulationPackage kuaishouPopulationPackage, Integer pageNo, Integer pageSize);
 

+ 28 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/IKuaishouProjectStrategyService.java

@@ -0,0 +1,28 @@
+package cn.com.ctop.kuaishou.modules.ai.service;
+
+import cn.com.ctop.kuaishou.modules.ai.entity.KuaishouProjectStrategy;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.jeecg.common.api.vo.Result;
+
+import java.util.List;
+
+/**
+ * 自动投放-项目策略表
+ *
+ * @author jeecg-boot
+ * 2021-06-24
+ * @version V1.0
+ */
+public interface IKuaishouProjectStrategyService extends IService<KuaishouProjectStrategy> {
+
+    Result<Object> queryProjectList(JSONObject data);
+
+    Result<Object> queryAccountList(JSONObject data);
+
+    Result<Object> queryMatchResult(Long projectId,Integer pageNo, Integer pageSize);
+
+    boolean checkProjectisOpen(Long projectId);
+
+    List<KuaishouProjectStrategy> getAllEffectStrategy(int unitType,String sourceMaterial);
+}

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

@@ -0,0 +1,19 @@
+package cn.com.ctop.kuaishou.modules.ai.service.impl;
+
+import cn.com.ctop.kuaishou.modules.ai.entity.AiKuaishouAccountLevelOperationRecord;
+import cn.com.ctop.kuaishou.modules.ai.mapper.AiKuaishouAccountLevelOperationRecordMapper;
+import cn.com.ctop.kuaishou.modules.ai.service.IAiKuaishouAccountLevelOperationRecordService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * 智能投放-账户层级操作记录表
+ *
+ * @author jeecg-boot
+ * 2021-07-11
+ * @version V1.0
+ */
+@Service
+public class AiKuaishouAccountLevelOperationRecordServiceImpl extends ServiceImpl<AiKuaishouAccountLevelOperationRecordMapper, AiKuaishouAccountLevelOperationRecord> implements IAiKuaishouAccountLevelOperationRecordService {
+
+}

Diff do ficheiro suprimidas por serem muito extensas
+ 1622 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/AiKuaishouProjectCreateCreativeServiceImpl.java


+ 27 - 2
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/KuaishouAppPackageServiceImpl.java

@@ -13,6 +13,7 @@ import cn.com.ctop.kuaishou.modules.ai.mapper.KuaishouAppGroupMapper;
 import cn.com.ctop.kuaishou.modules.ai.mapper.KuaishouAppPackageMapper;
 import cn.com.ctop.kuaishou.modules.ai.mapper.KuaishouAppPackageRelMapper;
 import cn.com.ctop.kuaishou.modules.ai.service.IKuaishouAppPackageService;
+import cn.com.ctop.kuaishou.modules.ai.service.IKuaishouMaterialPoolOperationRecordService;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouImageGet;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouImageGetService;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouMaterialUploadService;
@@ -66,7 +67,8 @@ public class KuaishouAppPackageServiceImpl extends ServiceImpl<KuaishouAppPackag
     private ISysRoleExtService sysRoleService;
     @Autowired
     private KuaishouAppPackageRelMapper relMapper;
-
+    @Autowired
+    private IKuaishouMaterialPoolOperationRecordService kuaishouMaterialPoolOperationRecordService;
     @Autowired
     private KuaishouAppGroupMapper appGroupMapper;
 
@@ -168,6 +170,7 @@ public class KuaishouAppPackageServiceImpl extends ServiceImpl<KuaishouAppPackag
             return Result.error("数据异常,重复的应用标记:" + errVersion.substring(0, errVersion.length() - 1));
         }
         appPackageMapper.replaceBatch(appList);
+        kuaishouMaterialPoolOperationRecordService.addRecord(JSONObject.parseObject(JSONObject.toJSONString(appList)).toJavaObject(JSONObject.class), "/importAppExcel", 3, "add");
         return Result.ok("文件导入成功");
     }
 
@@ -180,6 +183,23 @@ public class KuaishouAppPackageServiceImpl extends ServiceImpl<KuaishouAppPackag
         return LoadFileUtil.downLoadFromUrl(url, path.toString());
     }
 
+    @Override
+    public Result<Object> getProjectAppList(Long projectId) {
+        List<KuaishouAppPackage> list = appPackageMapper.getProjectAppList(projectId);
+        return Result.ok(list);
+    }
+
+    @Override
+    public Result<Object> getAppsDetail(List<Long> ids) {
+        List<JSONObject> list = relMapper.getAppsDetail(ids);
+        return Result.ok(list);
+    }
+
+    @Override
+    public JSONObject queryAppId(Long appTemId, Long accountId) {
+        return relMapper.queryAppId(appTemId, accountId);
+    }
+
     private String getCellValue(Cell cell) {
         String value = "";
         if (cell != null) {
@@ -222,7 +242,7 @@ public class KuaishouAppPackageServiceImpl extends ServiceImpl<KuaishouAppPackag
     }
 
     @Override
-    public Result<Object> pushAppPackage(Long id, JSONArray accountIds) {
+    public Result<Object> pushAppPackage(Long id, JSONArray accountIds, JSONObject object) {
         KuaishouAppPackage appPackage = appPackageMapper.selectById(id);
         if (Check.isNull(appPackage)) {
             return Result.error("未获取到应用信息");
@@ -292,6 +312,10 @@ public class KuaishouAppPackageServiceImpl extends ServiceImpl<KuaishouAppPackag
         if (!list.isEmpty()) {
             relMapper.replaceBatch(list);
         }
+        if (!Check.isNull(object)) {
+            object.put("projectId", appPackage.getProjectId());
+            kuaishouMaterialPoolOperationRecordService.addRecord(object, "/pushAppPackage", 3, "push");
+        }
         return Result.ok("推送完成");
     }
 
@@ -355,6 +379,7 @@ public class KuaishouAppPackageServiceImpl extends ServiceImpl<KuaishouAppPackag
             }
         }
         PageHelper.startPage(pageNo, pageSize);
+
         List<JSONObject> list = appPackageMapper.queryPageList(userId, kuaishouAppPackage.getAppName(), kuaishouAppPackage.getAppVersion(), kuaishouAppPackage.getProjectId(), kuaishouAppPackage.getPlatform());
         for (JSONObject object : list) {
             object.put("unitCount", appPackageMapper.queryUnitCount(object.getLong("id")));

+ 29 - 3
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/KuaishouDirectionalPackageServiceImpl.java

@@ -13,6 +13,7 @@ import cn.com.ctop.kuaishou.modules.ai.mapper.KuaishouDirectionalPackageMapper;
 import cn.com.ctop.kuaishou.modules.ai.mapper.KuaishouDirectionalPckageRelMapper;
 import cn.com.ctop.kuaishou.modules.ai.service.IKuaishouDirectionalPackageService;
 import cn.com.ctop.kuaishou.modules.ai.service.IKuaishouDirectionalPckageRelService;
+import cn.com.ctop.kuaishou.modules.ai.service.IKuaishouMaterialPoolOperationRecordService;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouGroup;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaishouTemplateTarget;
 import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouGroupMapper;
@@ -74,6 +75,8 @@ public class KuaishouDirectionalPackageServiceImpl extends ServiceImpl<KuaishouD
     @Autowired
     private IKuaiShouGroupTemplateService groupTemplateService;
     static ExecutorService executorService = null;
+    @Autowired
+    private IKuaishouMaterialPoolOperationRecordService kuaishouMaterialPoolOperationRecordService;
 
     @Override
     public Result<Object> createDirectionalPackage(JSONObject requestJson) {
@@ -374,20 +377,26 @@ public class KuaishouDirectionalPackageServiceImpl extends ServiceImpl<KuaishouD
     }
 
     @Override
-    public Result<Object> pushDirectionalPackage(String id, JSONArray datas) {
+    public Result<Object> pushDirectionalPackage(String id, JSONArray datas, JSONObject requestJson) {
         KuaishouDirectionalPackage directionalPackage = packageMapper.selectById(id);
+        if (Check.isNull(directionalPackage)) {
+            return Result.error("未获取到定向信息");
+        }
+        requestJson.put("projectId", directionalPackage.getProjectId());
         JSONObject data = JSONObject.parseObject(JSONObject.toJSONString(directionalPackage)).toJavaObject(JSONObject.class);
         if (Check.isNull(data)) {
             return Result.error("未找到定向包");
         }
         for (int i = 0; i < datas.size(); i++) {
             JSONObject request = datas.getJSONObject(i);
-            createDirectionalPackage(data, request);
+            createDirectionalPackage2(data, request);
         }
+        kuaishouMaterialPoolOperationRecordService.addRecord(requestJson, "/pushDirectionalPackage", 1, "push");
         return Result.ok("推送完成");
     }
 
-    private void createDirectionalPackage(JSONObject data, JSONObject request) {
+    @Override
+    public void createDirectionalPackage2(JSONObject data, JSONObject request) {
         Long accountId = request.getLong("accountId");
         CtopOauthToken oauthToken = oauthTokenService.getTokenByAccountId(accountId);
         String message = "";
@@ -675,4 +684,21 @@ public class KuaishouDirectionalPackageServiceImpl extends ServiceImpl<KuaishouD
         return Result.ok(data);
     }
 
+    @Override
+    public Result<Object> getProjectTarget(Long projectId, String templateName, Integer pageNo, Integer pageSize) {
+        PageHelper.startPage(pageNo, pageSize);
+        List<KuaishouDirectionalPackage> list = packageMapper.queryListByProjectId(projectId, templateName);
+        return Result.ok(new PageInfo(list));
+    }
+
+    @Override
+    public List<KuaishouDirectionalPackage> getProjectTargetByIds(List<String> ids) {
+        return packageMapper.getProjectTargetByIds(ids);
+    }
+
+    @Override
+    public Long selectTemplateId(String id, Long accountId) {
+        return relMapper.selectTemplateId(id, accountId);
+    }
+
 }

+ 68 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/KuaishouMaterialPoolOperationRecordServiceImpl.java

@@ -0,0 +1,68 @@
+package cn.com.ctop.kuaishou.modules.ai.service.impl;
+
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.kuaishou.modules.ai.entity.KuaishouMaterialPoolOperationRecord;
+import cn.com.ctop.kuaishou.modules.ai.mapper.KuaishouMaterialPoolOperationRecordMapper;
+import cn.com.ctop.kuaishou.modules.ai.service.IKuaishouMaterialPoolOperationRecordService;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.shiro.SecurityUtils;
+import org.jeecg.common.system.vo.LoginUser;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+/**
+ * 物料池操作记录表
+ *
+ * @author jeecg-boot
+ * 2021-07-19
+ * @version V1.0
+ */
+@Slf4j
+@Service
+public class KuaishouMaterialPoolOperationRecordServiceImpl extends ServiceImpl<KuaishouMaterialPoolOperationRecordMapper, KuaishouMaterialPoolOperationRecord> implements IKuaishouMaterialPoolOperationRecordService {
+
+    @Autowired
+    private KuaishouMaterialPoolOperationRecordMapper operationRecordMapper;
+
+    static ExecutorService executorService = Executors.newFixedThreadPool(3);
+
+    @Override
+    public void addRecord(JSONObject data, String methodName, Integer materialType, String type) {
+        Thread thread = new Thread() {
+            @Override
+            public void run() {
+                executorService.submit(new Runnable() {
+                    @Override
+                    public void run() {
+                        try {
+                            insertInfo(data, methodName, materialType, type);
+                        } catch (Exception e) {
+                            e.printStackTrace();
+                        }
+                    }
+                });
+                log.info("添加物料池操作记录完成");
+            }
+        };
+        thread.start();
+    }
+
+    private void insertInfo(JSONObject data, String methodName, Integer materialType, String type) {
+        KuaishouMaterialPoolOperationRecord record = new KuaishouMaterialPoolOperationRecord();
+        record.setData(JSONObject.toJSONString(data));
+        record.setMethod_name(methodName);
+        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+        if (!Check.isNull(user)) {
+            record.setUserId(user.getId());
+        }
+        record.setProjectId(data.getLong("projectId"));
+        record.setMaterialType(materialType);
+        record.setType(type);
+        operationRecordMapper.insert(record);
+    }
+}

+ 6 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/KuaishouPopulationPackageServiceImpl.java

@@ -10,6 +10,7 @@ import cn.com.ctop.kuaishou.modules.ai.entity.KuaishouPopulationPackage;
 import cn.com.ctop.kuaishou.modules.ai.entity.KuaishouPopulationPackageRel;
 import cn.com.ctop.kuaishou.modules.ai.mapper.KuaishouPopulationPackageMapper;
 import cn.com.ctop.kuaishou.modules.ai.mapper.KuaishouPopulationPackageRelMapper;
+import cn.com.ctop.kuaishou.modules.ai.service.IKuaishouMaterialPoolOperationRecordService;
 import cn.com.ctop.kuaishou.modules.ai.service.IKuaishouPopulationGroupService;
 import cn.com.ctop.kuaishou.modules.ai.service.IKuaishouPopulationPackageRelService;
 import cn.com.ctop.kuaishou.modules.ai.service.IKuaishouPopulationPackageService;
@@ -61,6 +62,8 @@ public class KuaishouPopulationPackageServiceImpl extends ServiceImpl<KuaishouPo
     private IKuaishouPopulationGroupService populationGroupService;
     @Autowired
     private ISysRoleExtService sysRoleService;
+    @Autowired
+    private IKuaishouMaterialPoolOperationRecordService kuaishouMaterialPoolOperationRecordService;
 
     @Value("${zip.local.download-path}")
     private String downloadPath;
@@ -119,7 +122,7 @@ public class KuaishouPopulationPackageServiceImpl extends ServiceImpl<KuaishouPo
     }
 
     @Override
-    public Result<Object> push(JSONArray accountIds, Long id) {
+    public Result<Object> push(JSONArray accountIds, Long id, JSONObject request) {
         KuaishouPopulationPackage pPackage = kuaishouPopulationPackageMapper.selectById(id);
         if (Check.isNull(pPackage)) {
             return Result.error("没有获取到人群包");
@@ -128,6 +131,7 @@ public class KuaishouPopulationPackageServiceImpl extends ServiceImpl<KuaishouPo
         if (Check.isNull(newFileUrl)) {
             return Result.error("本地下载文件失败,路径:" + pPackage.getUrl());
         }
+        request.put("projectId",pPackage.getProjectId());
         for (Object account : accountIds) {
             Long accountId = Long.valueOf(String.valueOf(account));
             KuaishouPopulationPackageRel relEntity = relMapper.queryEntity(accountId, pPackage.getId());
@@ -144,6 +148,7 @@ public class KuaishouPopulationPackageServiceImpl extends ServiceImpl<KuaishouPo
                 }
             }
         }
+        kuaishouMaterialPoolOperationRecordService.addRecord(request, "/kuaishouPopulationPackage/push", 2, "push");
         LoadFileUtil.delFile(newFileUrl);
         return Result.ok("推送结束");
     }

+ 92 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/KuaishouProjectStrategyServiceImpl.java

@@ -0,0 +1,92 @@
+package cn.com.ctop.kuaishou.modules.ai.service.impl;
+
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.kuaishou.modules.ai.entity.KuaishouProjectStrategy;
+import cn.com.ctop.kuaishou.modules.ai.mapper.AiKuaishouAccountLevelOperationRecordMapper;
+import cn.com.ctop.kuaishou.modules.ai.mapper.KuaishouProjectStrategyMapper;
+import cn.com.ctop.kuaishou.modules.ai.service.IKuaishouProjectStrategyService;
+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.jeecg.common.api.vo.Result;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 自动投放-项目策略表
+ *
+ * @author jeecg-boot
+ * 2021-06-24
+ * @version V1.0
+ */
+@Service
+public class KuaishouProjectStrategyServiceImpl extends ServiceImpl<KuaishouProjectStrategyMapper, KuaishouProjectStrategy> implements IKuaishouProjectStrategyService {
+
+    @Autowired
+    private KuaishouProjectStrategyMapper kuaishouProjectStrategyMapper;
+
+    @Autowired
+    private AiKuaishouAccountLevelOperationRecordMapper kuaishouAccountLevelOperationRecordMapper;
+
+    @Override
+    public Result<Object> queryProjectList(JSONObject data) {
+        List<Long> projectIds = new ArrayList<>();
+        if (Check.isNull(data.getLong("projectId"))) {
+            projectIds = kuaishouProjectStrategyMapper.queryProjectId();
+        } else {
+            projectIds.add(data.getLong("projectId"));
+        }
+        data.put("projectIds", projectIds);
+        JSONObject result = new JSONObject();
+        JSONObject allInfo = kuaishouProjectStrategyMapper.queryProjectAll(data);
+        Integer pageNo = Check.isNull(data.getInteger("pageNo")) ? 1 : data.getInteger("pageNo");
+        Integer pageSize = Check.isNull(data.getInteger("pageSize")) ? 10 : data.getInteger("pageSize");
+        PageHelper.startPage(pageNo, pageSize);
+        List<JSONObject> list = kuaishouProjectStrategyMapper.queryProjectList(data);
+        result.put("total", allInfo);
+        result.put("pageInfo", new PageInfo<>(list));
+        return Result.ok(result);
+    }
+
+    @Override
+    public Result<Object> queryAccountList(JSONObject data) {
+        List<Long> projectIds = new ArrayList<>();
+        if (Check.isNull(data.getLong("projectId"))) {
+            projectIds = kuaishouProjectStrategyMapper.queryProjectId();
+        } else {
+            projectIds.add(data.getLong("projectId"));
+        }
+        data.put("projectIds", projectIds);
+        JSONObject result = new JSONObject();
+        JSONObject allInfo = kuaishouProjectStrategyMapper.queryAccountAll(data);
+        Integer pageNo = Check.isNull(data.getInteger("pageNo")) ? 1 : data.getInteger("pageNo");
+        Integer pageSize = Check.isNull(data.getInteger("pageSize")) ? 10 : data.getInteger("pageSize");
+        PageHelper.startPage(pageNo, pageSize);
+        List<JSONObject> list = kuaishouProjectStrategyMapper.queryAccountList(data);
+        result.put("total", allInfo);
+        result.put("pageInfo", new PageInfo<>(list));
+        return Result.ok(result);
+    }
+
+    @Override
+    public Result<Object> queryMatchResult(Long projectId, Integer pageNo, Integer pageSize) {
+        PageHelper.startPage(pageNo, pageSize);
+        List<JSONObject> list = kuaishouAccountLevelOperationRecordMapper.queryMatchResult(projectId);
+        return Result.ok(new PageInfo<>(list));
+    }
+
+    @Override
+    public boolean checkProjectisOpen(Long projectId) {
+        Integer num = kuaishouProjectStrategyMapper.checkProjectisOpen(projectId);
+        return num <= 0;
+    }
+
+    @Override
+    public List<KuaishouProjectStrategy> getAllEffectStrategy(int unitType, String sourceMaterial) {
+        return kuaishouProjectStrategyMapper.getAllEffectStrategy(unitType, sourceMaterial);
+    }
+}

+ 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;
+    }
+
+
     /**
      * 分页列表查询
      *

+ 15 - 3
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/entity/KuaiShouVideoGet.java

@@ -1,5 +1,6 @@
 package cn.com.ctop.kuaishou.modules.batch.entity;
 
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.fasterxml.jackson.annotation.JsonFormat;
@@ -44,13 +45,24 @@ public class KuaiShouVideoGet {
     private Integer materialType;
     private Integer channelType;
     private Integer status;
-    /**素造素材标签*/
+    /**
+     * 素造素材标签
+     */
     private String materialTag;
-    /**素造供应商id*/
+    /**
+     * 素造供应商id
+     */
     private Long supplierAccountId;
-    /**供应商名称*/
+    /**
+     * 供应商名称
+     */
     private String supplierAccountName;
 
+    @TableField(exist = false)
+    private String putStartTime;
+    @TableField(exist = false)
+    private String putEndTime;
+
     /**
      * 创建时间
      */

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

+ 7 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/KuaishouProjectVideoGetMapper.java

@@ -1,5 +1,6 @@
 package cn.com.ctop.kuaishou.modules.batch.mapper;
 
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouVideoGet;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaishouProjectVideoGet;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
@@ -27,10 +28,15 @@ public interface KuaishouProjectVideoGetMapper extends BaseMapper<KuaishouProjec
 
     JSONObject getVideoTotalNumber(Map<String, Object> paramsMap);
 
-    JSONObject getVideoDetails(@Param("signature") String signature,@Param("id") String id);
+    JSONObject getVideoDetails(@Param("signature") String signature, @Param("id") String id);
 
     Long getAccountVideosTotal(@Param("signature") String signature, @Param("projectId") Long projectId);
 
     List<JSONObject> getAccountVideos(@Param("signature") String signature, @Param("projectId") Long projectId);
 
+    List<KuaiShouVideoGet> getNewVideoBetweenTime(@Param("accountId") Long accountId, @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("channelType") Integer channelType);
+
+    List<KuaiShouVideoGet> getZeroVideoByParams(@Param("accountId") Long accountId, @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("videoCnt") Long videoCnt, @Param("appVersion") String appVersion, @Param("channelType") Integer channelType, @Param("relativeCnt") Integer relativeCnt);
+
+    List<KuaiShouVideoGet> getHistoryTopVideoByParams(@Param("accountId") Long accountId, @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("videoCnt") Long videoCnt, @Param("appVersion") String appVersion, @Param("channelType") Integer channelType);
 }

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

@@ -18,4 +18,6 @@ public interface KuaishouTemplateTargetMapper extends BaseMapper<KuaishouTemplat
     void templateTargetList(@Param("templateTargetList") List<KuaishouTemplateTarget> templateTargetList);
 
     KuaishouTemplateTarget queryTemplateTarget(@Param("templateId") Long templateId, @Param("accountId")Long accountId);
+
+    List<KuaishouTemplateTarget> queryTemplateTargetByIds(@Param("templateIds") List<Long> templateIds);
 }

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

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

@@ -94,7 +94,7 @@
 
     <select id="selectPhotoIdsByAccountId" parameterType="java.lang.Long"
             resultType="cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouVideoGet">
-        select *
+        select photo_id,stat_date,channel_type
         from ctop_kuaishou_video_get
         where account_id = #{accountId}
           and status = 0
@@ -339,6 +339,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

+ 120 - 6
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaishouProjectVideoGetMapper.xml

@@ -202,12 +202,14 @@
                IFNULL(ROUND(SUM(t1.charge) / SUM(t1.aclick) * 1000, 2), 0) 'impression1kCost',
                IFNULL(ROUND(SUM(t1.charge) / SUM(t1.photo_click), 2), 0) 'photoClickCost',
                IFNULL(ROUND(SUM(t1.charge) / SUM(t1.bclick), 2), 0) 'actionCost'
-        FROM  ctop_kuaishou_video_get t0
-                  LEFT JOIN ctop_kuaishou_report_daily_material t1 ON t0.account_id = t1.account_id
-                  LEFT JOIN ctop_user_allocation t2 ON t0.account_id = t2.account_id
-                  LEFT JOIN (
-            SELECT IFNULL(COUNT(1),0) 'rejectCount',account_id FROM ctop_kuaishou_creative WHERE `status` = 42
-            and account_id IN (SELECT account_id FROM ctop_user_allocation where project_id = #{projectId})
+        FROM ctop_kuaishou_video_get t0
+                 LEFT JOIN ctop_kuaishou_report_daily_material t1 ON t0.account_id = t1.account_id
+                 LEFT JOIN ctop_user_allocation t2 ON t0.account_id = t2.account_id
+                 LEFT JOIN (
+            SELECT IFNULL(COUNT(1), 0) 'rejectCount',account_id
+            FROM ctop_kuaishou_creative
+            WHERE `status` = 42
+              and account_id IN (SELECT account_id FROM ctop_user_allocation where project_id = #{projectId})
             GROUP BY account_id
         ) t3 ON t0.account_id = t3.account_id
         WHERE t2.project_id = #{projectId}
@@ -215,4 +217,116 @@
         GROUP BY t0.account_id
     </select>
 
+    <select id="getNewVideoBetweenTime" resultType="cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouVideoGet">
+        select t2.*,t1.put_end_time,t1.put_start_time
+        from ctop_kuaishou_project_video_get t1
+                 INNER JOIN
+             (
+                 SELECT tt1.*, tt2.project_id
+                 FROM ctop_user_allocation tt2
+                 LEFT JOIN ctop_kuaishou_video_get tt1 ON tt2.account_id = tt1.account_id
+                 WHERE tt2.account_id = #{accountId}
+                 and tt1.signature is not null
+                 group by tt1.signature
+             ) t2 ON t1.project_id = t2.project_id AND t1.signature = t2.signature
+        WHERE t1.status = 0
+        <if test="startTime!=null">
+            AND t1.stat_date &gt;= #{startTime}
+        </if>
+        <if test="endTime!=null">
+            and t1.stat_date &lt;= #{endTime}
+        </if>
+        <if test="channelType!=null">
+            AND t1.channel_type = #{channelType}
+        </if>
+    </select>
+
+    <select id="getZeroVideoByParams" resultType="cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouVideoGet">
+        select t1.* from (
+        select t2.*,t1.put_end_time,t1.put_start_time
+        from ctop_kuaishou_project_video_get t1
+        INNER JOIN
+        (
+        SELECT tt1.*, tt2.project_id
+        FROM ctop_user_allocation tt2
+        LEFT JOIN ctop_kuaishou_video_get tt1 ON tt2.account_id = tt1.account_id
+        WHERE tt2.account_id = #{accountId}
+        and tt1.signature is not null
+        <if test="appVersion != null and appVersion != '' ">
+            and tt1.photo_name like concat(#{appVersion},'%')
+        </if>
+        group by tt1.signature
+        ) t2 ON t1.project_id = t2.project_id AND t1.signature = t2.signature
+        WHERE t1.status = 0
+        <if test="startTime!=null">
+            AND t1.stat_date &gt;= #{startTime}
+        </if>
+        <if test="endTime!=null">
+            and t1.stat_date &lt;= #{endTime}
+        </if>
+        <if test="channelType!=null">
+            AND t1.channel_type = #{channelType}
+        </if>
+        ) t1
+        left join ctop_kuaishou_video_relate_creatives t2 on t1.photo_id =
+        t2.photo_id and t1.account_id = t2.account_id
+        where
+        1=1
+        <if test="relativeCnt!=null">
+            and t2.creative_count &lt;= #{relativeCnt}
+        </if>
+        order by t1.stat_date desc
+        <if test="videoCnt!=null">
+            limit #{videoCnt}
+        </if>
+    </select>
+
+    <select id="getHistoryTopVideoByParams"
+            resultType="cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouVideoGet">
+        select
+        t2.*
+        from
+        ctop_kuaishou_report_daily_material t1
+        left join (
+        select t2.*,t1.put_end_time,t1.put_start_time
+        from ctop_kuaishou_project_video_get t1
+        INNER JOIN
+        (
+        SELECT tt1.*, tt2.project_id
+        FROM ctop_user_allocation tt2
+        LEFT JOIN ctop_kuaishou_video_get tt1 ON tt2.account_id = tt1.account_id
+        WHERE tt2.account_id = #{accountId}
+        and tt1.signature is not null
+        <if test="appVersion != null and appVersion != '' ">
+            and tt1.photo_name like concat(#{appVersion},'%')
+        </if>
+        group by tt1.signature
+        ) t2 ON t1.project_id = t2.project_id AND t1.signature = t2.signature
+        WHERE t1.status = 0
+        <if test="startTime!=null">
+            AND t1.stat_date &gt;= #{startTime}
+        </if>
+        <if test="endTime!=null">
+            and t1.stat_date &lt;= #{endTime}
+        </if>
+        <if test="channelType!=null">
+            AND t1.channel_type = #{channelType}
+        </if>
+        ) t2
+        on t1.signature = t2.signature
+        where t2.id is not null
+        and t2.photo_id NOT IN (
+        SELECT
+        photo_id
+        FROM
+        ctop_ai_creative_limit
+        WHERE
+        account_id = #{accountId}
+        )
+        group by t2.signature
+        order by sum(t1.charge) desc
+        <if test="videoCnt!=null">
+            limit #{videoCnt}
+        </if>
+    </select>
 </mapper>

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

@@ -96,5 +96,16 @@
           AND t2.account_id = #{accountId}
     </select>
 
+    <select id="queryTemplateTargetByIds" resultType="cn.com.ctop.kuaishou.modules.batch.entity.KuaishouTemplateTarget">
+        SELECT *
+        FROM ctop_kuaishou_template_target t1
+        WHERE t1.template_id in
+        <foreach collection="templateIds" item="item" separator=","
+                 open="(" close=")">
+            #{item}
+        </foreach>
+
+    </select>
+
 
 </mapper>

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

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

@@ -1,5 +1,6 @@
 package cn.com.ctop.kuaishou.modules.batch.service;
 
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouVideoGet;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaishouProjectVideoGet;
 import com.baomidou.mybatisplus.extension.service.IService;
 import org.jeecg.common.api.vo.Result;
@@ -30,4 +31,10 @@ public interface IKuaishouProjectVideoGetService extends IService<KuaishouProjec
     Result<Object> queryCreativeBySignature(List<String> photoIds, Long accountId, Integer pageNo, Integer pageSize);
 
     void deleteCreativesByPhotoId(Object photoId);
+
+    List<KuaiShouVideoGet> getNewVideoBetweenTime(Long accountId, String startTime, String endTime, Integer channelType);
+
+    List<KuaiShouVideoGet> getZeroVideoByParams(Long accountId, String startTime, String endTime, Long videoCnt, String appVersion, Integer channelType, Integer relativeCnt);
+
+    List<KuaiShouVideoGet> getHistoryTopVideoByParams(Long accountId, String startTime, String endTime, Long videoCnt, String appVersion, Integer channelType);
 }

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

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

@@ -8,18 +8,67 @@ import cn.com.ctop.common.module.mapper.UserAllocationMapper;
 import cn.com.ctop.common.module.service.IMaterialCutFrameService;
 import cn.com.ctop.common.module.service.IOauthConfigService;
 import cn.com.ctop.common.module.service.IUserAllocationService;
-import cn.com.ctop.common.module.utils.*;
-import cn.com.ctop.kuaishou.modules.ai.service.*;
-import cn.com.ctop.kuaishou.modules.batch.entity.*;
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.common.module.utils.CtopAdConstant;
+import cn.com.ctop.common.module.utils.HttpUtils;
+import cn.com.ctop.common.module.utils.JsonUtil;
+import cn.com.ctop.common.module.utils.KuaishouInterfaceConstant;
+import cn.com.ctop.common.module.utils.PropertiesUtils;
+import cn.com.ctop.kuaishou.modules.ai.service.IAiCreativeLimitService;
+import cn.com.ctop.kuaishou.modules.ai.service.IKuaishouAccountCreativeOverrunInfoService;
+import cn.com.ctop.kuaishou.modules.ai.service.IKuaishouAppPackageService;
+import cn.com.ctop.kuaishou.modules.ai.service.IKuaishouDirectionalPackageService;
+import cn.com.ctop.kuaishou.modules.ai.service.IKuaishouLandpagePackageService;
+import cn.com.ctop.kuaishou.modules.ai.service.IKuaishouPopulationGroupService;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouAdvertiserBaseInfo;
+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.KuaiShouDailyFlows;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouGroup;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouImageGet;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouRegionListChildren;
+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.vo.ConvertVo;
-import cn.com.ctop.kuaishou.modules.batch.mapper.*;
-import cn.com.ctop.kuaishou.modules.batch.service.*;
+import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouAdvertiserBaseInfoMapper;
+import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouAppListMapper;
+import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouGroupMapper;
+import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouRegionListChildrenMapper;
+import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouRegionListParentMapper;
+import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouTargetingTagsMapper;
+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.IKuaiShouDailyFlowsService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouGroupService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouHistoryReportTaskService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouImageGetService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouOverRunSendMessageService;
+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.IWarningOperationService;
 import cn.com.ctop.kuaishou.modules.material.entity.KuaishouResult;
 import cn.com.ctop.kuaishou.modules.material.entity.KuaishouResultToken;
-import cn.com.ctop.kuaishou.modules.report.entity.*;
+import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAccount;
+import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyCampaign;
+import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyCreative;
+import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyCreativeStatistic;
+import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportHourlyAccount;
+import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportHourlyCampaign;
+import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportHourlyCreative;
+import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportHourlyCreativeStatistic;
+import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportHourlyGroup;
 import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyAccountMapper;
 import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyCampaignMapper;
-import cn.com.ctop.kuaishou.modules.report.service.*;
+import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyCampaignService;
+import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyCreativeService;
+import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportHourlyAccountService;
+import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportHourlyCampaignService;
+import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportHourlyCreativeService;
+import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportHourlyGroupService;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
@@ -54,7 +103,11 @@ import java.io.IOException;
 import java.lang.reflect.ParameterizedType;
 import java.lang.reflect.Type;
 import java.text.SimpleDateFormat;
-import java.util.*;
+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;
 
@@ -130,6 +183,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
     private IKuaishouAppPackageService appPackageService;
     @Autowired
     private UserAllocationMapper allocationMapper;
+
     @Override
     public void getAdvertiserReportHourly(CtopOauthToken token, Date startDate, Date endDate) {
         try {
@@ -268,8 +322,10 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
             if (!Check.isNull(videoGetList)) {
                 videoGetService.replaceBatch(videoGetList);
             }
-
-            getVideoListByPage(token, startDate, endDate, page + 1);
+            Integer total_count = resultJson.getJSONObject("data").getInteger("total_count");
+            if (!Check.isNull(total_count) && total_count == 500) {
+                getVideoListByPage(token, startDate, endDate, page + 1);
+            }
         } catch (Exception e) {
             e.printStackTrace();
         }
@@ -781,26 +837,26 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
     @Override
     public void loadKuaishouDataSingle(CtopOauthToken token) throws java.text.ParseException {
         String beginDateStr = allocationMapper.getUserAllocation(token.getAccountId()).getAuthBeginTime();
-        beginDateStr = Check.isNull(beginDateStr) ? DateUtils.formatDate(DateUtils.addDay(new Date(),-180),"yyyy-MM-dd") : beginDateStr;
-        Date beginDate = DateUtils.parseDate(beginDateStr,DateUtils.WEB_FORMAT);
-        Date endDate = DateUtils.addDay(new Date(),-1);
-        while (!beginDate.after(endDate)){
-            beginDate = DateUtils.addDay(beginDate,1);
+        beginDateStr = Check.isNull(beginDateStr) ? DateUtils.formatDate(DateUtils.addDay(new Date(), -180), "yyyy-MM-dd") : beginDateStr;
+        Date beginDate = DateUtils.parseDate(beginDateStr, DateUtils.WEB_FORMAT);
+        Date endDate = DateUtils.addDay(new Date(), -1);
+        while (!beginDate.after(endDate)) {
+            beginDate = DateUtils.addDay(beginDate, 1);
             getAdvertiserReportHourly(token, beginDate, beginDate);
             getAdvertiserReportDaily(token, beginDate, beginDate, null);
         }
 //        Date endDate = new Date();
 //        for (int i = 0; i < 7; i++) {
 //            Date getStartDate = DateUtils.addDay(endDate, -i);
-            //1: 获取广告主信息数据
+        //1: 获取广告主信息数据
 //            getAdvertiserReportHourly(token, beginDate, endDate);
 //            getAdvertiserReportDaily(token, beginDate, endDate, null);
-            //2:获取广告计划信息数据
-            //getAdvertiserCampaignReportHourly(token, getStartDate, getStartDate);
-            //3:获取广告组信息数据
-            // getAdvertiserGroupReportHourly(token, getStartDate, getStartDate);
-            //4: 获取广告创意信息数据
-            // getAdvertiserCreativeReportHourly(token, getStartDate, getStartDate);
+        //2:获取广告计划信息数据
+        //getAdvertiserCampaignReportHourly(token, getStartDate, getStartDate);
+        //3:获取广告组信息数据
+        // getAdvertiserGroupReportHourly(token, getStartDate, getStartDate);
+        //4: 获取广告创意信息数据
+        // getAdvertiserCreativeReportHourly(token, getStartDate, getStartDate);
 //        }
         //获取全量广告计划数据
         getCampaignList(token, null, null);
@@ -810,7 +866,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
         getCreativeList(token, null, null);
         getAppList(token.getAccountId(), token.getAccessToken());
         log.info("----------------开始历史数据获取,accountId:{}", token.getAccountId());
-        String endDateStr = DateUtils.formatDate(endDate,"yyyy-MM-dd");
+        String endDateStr = DateUtils.formatDate(endDate, "yyyy-MM-dd");
 //        String startDate = DateUtils.addMonth(endDateStr, -1);
         historyReportTaskService.createTask(token.getAccountId(), token.getAccessToken(), beginDateStr, endDateStr, CtopAdConstant.KUAISHOU_LOAD_JOB_TYPE_HISTORY);
         getVideoList(token, null, null);
@@ -1999,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("超过可关联的有效创意的上限")) {

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

@@ -3,6 +3,7 @@ package cn.com.ctop.kuaishou.modules.batch.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.batch.entity.KuaiShouVideoGet;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaishouProjectVideoGet;
 import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouCreativeMapper;
 import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouVideoGetMapper;
@@ -158,4 +159,19 @@ public class KuaishouProjectVideoGetServiceImpl extends ServiceImpl<KuaishouProj
             }
         }
     }
+
+    @Override
+    public List<KuaiShouVideoGet> getNewVideoBetweenTime(Long accountId, String startTime, String endTime, Integer channelType) {
+        return projectVideoGetMapper.getNewVideoBetweenTime(accountId, startTime, endTime, channelType);
+    }
+
+    @Override
+    public List<KuaiShouVideoGet> getZeroVideoByParams(Long accountId, String startTime, String endTime, Long videoCnt, String appVersion, Integer channelType, Integer relativeCnt) {
+        return projectVideoGetMapper.getZeroVideoByParams(accountId, startTime, endTime, videoCnt, appVersion, channelType, relativeCnt);
+    }
+
+    @Override
+    public List<KuaiShouVideoGet> getHistoryTopVideoByParams(Long accountId, String startTime, String endTime, Long videoCnt, String appVersion, Integer channelType) {
+        return projectVideoGetMapper.getHistoryTopVideoByParams(accountId, startTime, endTime, videoCnt, appVersion, channelType);
+    }
 }

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

@@ -136,7 +136,7 @@ public class KuaishouVideoRelateCreativesServiceImpl extends ServiceImpl<Kuaisho
                             kuaishouVideoRelateCreativesMapper.insertBatch(videolist);
                         }
                     } else {
-                        log.info("频库-视频关联创意数查询失败,accountId:{},返回信息:{}", accountId, resultJson);
+                        log.info("频库-视频关联创意数查询失败,入参:{},返回结果:{}", params, resultJson);
                     }
                 }
             }
@@ -151,17 +151,17 @@ public class KuaishouVideoRelateCreativesServiceImpl extends ServiceImpl<Kuaisho
     }
 
     @Override
-    public List<KuaishouVideoRelateCreatives> listByParams(Long accountId,Integer matNum) {
+    public List<KuaishouVideoRelateCreatives> listByParams(Long accountId, Integer matNum) {
         QueryWrapper<KuaishouVideoRelateCreatives> queryWrapper = new QueryWrapper<>();
-        if(null!=accountId&&accountId!=0){
-            queryWrapper.eq("account_id",accountId);
+        if (null != accountId && accountId != 0) {
+            queryWrapper.eq("account_id", accountId);
         }
-        if(null == matNum||matNum == 0){
+        if (null == matNum || matNum == 0) {
             matNum = 10;
         }
-        queryWrapper.le("creative_count",30);
+        queryWrapper.le("creative_count", 30);
         queryWrapper.orderByDesc("stat_date");
-        queryWrapper.last("limit "+matNum);
+        queryWrapper.last("limit " + matNum);
         return this.list(queryWrapper);
     }
 
@@ -188,18 +188,20 @@ public class KuaishouVideoRelateCreativesServiceImpl extends ServiceImpl<Kuaisho
             int count = 0;
             for (KuaiShouVideoGet video : KuaiShouVideoGets) {
                 count++;
-                if (count < 20) {
+                if (count < 19) {
                     photoIds.add(video.getPhotoId());
                     statdateMap.put(video.getPhotoId(), video);
                 } else {
                     photoIds.add(video.getPhotoId());
-                    statdateMap.put(video.getPhotoId(),video);
+                    statdateMap.put(video.getPhotoId(), video);
                     dateList.add(photoIds);
                     photoIds = new JSONArray();
                     count = 0;
                 }
             }
-            dateList.add(photoIds);
+            if (photoIds.size() > 0) {
+                dateList.add(photoIds);
+            }
             this.videoRelateCreatives(accountId, dateList, statdateMap);
         }
     }

+ 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(2);
+
+
+    /**
+     * 创建组
+     *
+     * @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("文件导入失败!");
+    }
+
+}

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

@@ -0,0 +1,440 @@
+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.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.jeecg.common.api.vo.Result;
+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;
+
+
+    @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);
+        }
+        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("策略配置应用不能为空");
+            }
+
+            kuaiShouDimensionStrategyService.insertStrategy(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;
+}

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

@@ -0,0 +1,200 @@
+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;
+
+    @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;
+}

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


Alguns ficheiros não foram mostrados porque muitos ficheiros mudaram neste diff