Просмотр исходного кода

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

zhaoxian 4 лет назад
Родитель
Сommit
1843eca731
100 измененных файлов с 4937 добавлено и 1180 удалено
  1. 35 4
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/DateUtils.java
  2. 6 2
      jeecg-boot-module-system/pom.xml
  3. 0 70
      jeecg-boot-module-system/src/main/java/org/jeecg/JeecgOneToMainUtil.java
  4. 18 11
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/AiKuaishouAdvertiserStrategyController.java
  5. 202 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/BytedanceCustomerDdTbtjDataController.java
  6. 135 70
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialInfoController.java
  7. 9 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ProjectMemberController.java
  8. 310 61
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/TestController.java
  9. 37 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/BytedanceCustomerDdTbtjData.java
  10. 0 84
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouHourlyGroupReportLoadJob.java
  11. 19 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/BytedanceCustomerDdTbtjDataMapper.java
  12. 24 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/xml/BytedanceCustomerDdTbtjDataMapper.xml
  13. 18 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/IBytedanceCustomerDdTbtjDataService.java
  14. 28 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/BytedanceCustomerDdTbtjDataServiceImpl.java
  15. 50 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/excelutil/BytedanceCustomTbtjDataExcelListener.java
  16. 0 17
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/excelutil/JhsBakendDataExcelListener.java
  17. 73 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/excelutil/entity/BytedanceCustomTbtjDataEntity.java
  18. 2 0
      jeecg-boot-module-system/src/main/resources/application-dev.yml
  19. 2 0
      jeecg-boot-module-system/src/main/resources/application-jiaoyang.yml
  20. 265 0
      jeecg-boot-module-system/src/main/resources/application-preprod.yml
  21. 2 0
      jeecg-boot-module-system/src/main/resources/application-prod.yml
  22. 2 0
      jeecg-boot-module-system/src/main/resources/application-prod2.yml
  23. 2 0
      jeecg-boot-module-system/src/main/resources/application-test.yml
  24. 2 1
      jeecg-boot-module-system/src/main/resources/application-wps.yml
  25. 4 11
      jeecg-boot-module-system/src/main/resources/jeecg/code-template/one/java/${bussiPackage}/${entityPackage}/controller/${entityName}Controller.javai
  26. 3 3
      jeecg-boot-module-system/src/main/resources/jeecg/code-template/one/java/${bussiPackage}/${entityPackage}/mapper/${entityName}Mapper.javai
  27. 4 4
      jeecg-boot-module-system/src/main/resources/jeecg/code-template/one/java/${bussiPackage}/${entityPackage}/service/I${entityName}Service.javai
  28. 1 1
      jeecg-boot-module-system/src/main/resources/jeecg/code-template/one/java/${bussiPackage}/${entityPackage}/service/impl/${entityName}ServiceImpl.javai
  29. 1 18
      jeecg-boot-module-system/src/main/resources/jeecg/jeecg_database.properties
  30. 100 405
      jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java
  31. 20 13
      module-common/src/main/java/cn/com/ctop/common/module/entity/MaterialInfo.java
  32. 3 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/MaterialInfoMapper.java
  33. 44 36
      module-common/src/main/java/cn/com/ctop/common/module/mapper/SysDepartMapper.java
  34. 1 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/SysRoleMapper.java
  35. 3 1
      module-common/src/main/java/cn/com/ctop/common/module/mapper/SysUserDepartMapper.java
  36. 6 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/MaterialInfoMapper.xml
  37. 33 13
      module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/SysDepartMapper.xml
  38. 18 14
      module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/SysRoleMapper.xml
  39. 16 7
      module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/SysUserDepartMapper.xml
  40. 3 0
      module-common/src/main/java/cn/com/ctop/common/module/service/IMaterialInfoService.java
  41. 1 1
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/FileInfoServiceImpl.java
  42. 10 7
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialInfoServiceImpl.java
  43. 794 0
      module-common/src/main/java/cn/com/ctop/common/module/utils/ConverterUtils.java
  44. 4 0
      module-common/src/main/java/cn/com/ctop/common/module/utils/KuaishouInterfaceConstant.java
  45. 10 0
      module-common/src/main/java/cn/com/ctop/common/module/utils/StringUtils.java
  46. 18 0
      module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceAiCreateJob.java
  47. 16 0
      module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceEtlVideoJob.java
  48. 3 0
      module-job-bytedance/src/main/resources/application-dev.yml
  49. 3 0
      module-job-bytedance/src/main/resources/application-jiaoyang.yml
  50. 3 0
      module-job-bytedance/src/main/resources/application-prod.yml
  51. 3 0
      module-job-bytedance/src/main/resources/application-test.yml
  52. 7 0
      module-job-kuaishou/pom.xml
  53. 64 0
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaiShouBudgetJob.java
  54. 9 4
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouAiCreativeJob.java
  55. 6 2
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouCreateUnitJob.java
  56. 4 1
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouDailyAccountReportLoadEtlJob.java
  57. 3 3
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouDailyAccountReportLoadJob.java
  58. 10 2
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouEtlVideoJob.java
  59. 48 19
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouHourlyGroupReportLoadJob.java
  60. 66 2
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouMatDailyReportJob.java
  61. 5 0
      module-job-kuaishou/src/main/resources/application-dev.yml
  62. 7 0
      module-job-kuaishou/src/main/resources/application-jiaoyang.yml
  63. 239 0
      module-job-kuaishou/src/main/resources/application-preprod.yml
  64. 3 1
      module-job-kuaishou/src/main/resources/application-prod.yml
  65. 4 0
      module-job-kuaishou/src/main/resources/application-test.yml
  66. 18 10
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/controller/AiKuaishouCreateCreativeController.java
  67. 1 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/entity/AiKuaishouAdvertiserStrategy.java
  68. 241 157
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/AiKuaishouCreateCreativeServiceImpl.java
  69. 76 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/app/entity/KuaishouAccountBalanceBudget.java
  70. 19 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/app/mapper/KuaishouAccountBalanceBudgetMapper.java
  71. 36 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/app/mapper/xml/KuaishouAccountBalanceBudgetMapper.xml
  72. 18 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/app/service/IKuaishouAccountBalanceBudgetService.java
  73. 32 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/app/service/impl/KuaishouAccountBalanceBudgetServiceImpl.java
  74. 37 20
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/BatchController.java
  75. 6 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaiShouVideoGetController.java
  76. 1 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/entity/KuaiShouGroupTemplate.java
  77. 7 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouReportDailyMaterialMapper.xml
  78. 7 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouVideoGetMapper.xml
  79. 4 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaiShouCreativeService.java
  80. 4 2
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaiShouReportDailyMaterialService.java
  81. 2 13
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaishouInterfaceService.java
  82. 7 2
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/BatchServiceImpl.java
  83. 5 3
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouActionBarTextServiceImpl.java
  84. 76 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouCreativeServiceImpl.java
  85. 8 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouGroupTemplateServiceImpl.java
  86. 194 7
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouHistoryReportTaskServiceImpl.java
  87. 14 5
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouReportDailyMaterialServiceImpl.java
  88. 2 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouUpdateServiceImpl.java
  89. 36 61
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl.java
  90. 129 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/EtlKuaishouReportAccountHourlyController.java
  91. 248 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/KuaiShouProjectDataController.java
  92. 248 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/KuaiShouReportHourlyMaterialController.java
  93. 15 9
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/EtlKuaishouReportAccountHourly.java
  94. 71 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/KuaiShouProjectData.java
  95. 2 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/KuaiShouReportDailyMaterial.java
  96. 425 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/KuaiShouReportHourlyMaterial.java
  97. 7 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/KuaishouReportDailyAccount.java
  98. 6 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/KuaishouReportHourlyAccount.java
  99. 94 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/enums/CheckParametersCostEnum.java
  100. 0 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/EtlKuaishouReportAccountDailyMapper.java

+ 35 - 4
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/DateUtils.java

@@ -10,7 +10,14 @@ import java.sql.Timestamp;
 import java.text.DateFormat;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.GregorianCalendar;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
 
 /**
  * 类描述:时间操作定义类
@@ -146,8 +153,6 @@ public class DateUtils extends PropertyEditorSupport {
     }
 
 
-
-
     // 指定模式的时间格式
     private static SimpleDateFormat getSDFormat(String pattern) {
         return new SimpleDateFormat(pattern);
@@ -1579,11 +1584,37 @@ public class DateUtils extends PropertyEditorSupport {
     }
 
     /**
-     * 获取两个日期之间的所有日期集合
+     * 根据数字查询本周对应的日期
+     * 1-7对应周一~周天
+     *
+     * @param
+     * @return java.lang.String
+     * @throws
      * @author ZHAOXA
+     */
+    public static String getdateFromWeek(int number) {
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+        Calendar calendar = Calendar.getInstance();
+
+        while (calendar.get(Calendar.DAY_OF_WEEK) != Calendar.MONDAY) {
+            calendar.add(Calendar.DAY_OF_WEEK, -1);
+        }
+        for (int i = 1; i <= 7; i++) {
+            if (number == i) {
+                return sdf.format(calendar.getTime());
+            }
+            calendar.add(Calendar.DAY_OF_MONTH, 1);
+        }
+        return null;
+    }
+
+    /**
+     * 获取两个日期之间的所有日期集合
+     *
      * @param
      * @return java.util.List<java.lang.String>
      * @throws
+     * @author ZHAOXA
      */
     public static List<String> getDays(String startTime, String endTime) {
         // 返回的日期集合

+ 6 - 2
jeecg-boot-module-system/pom.xml

@@ -75,13 +75,11 @@
             <groupId>cn.com.ctop</groupId>
             <artifactId>module-toutiao</artifactId>
             <version>2.0.2</version>
-            <scope>compile</scope>
         </dependency>
         <dependency>
             <groupId>cn.com.ctop</groupId>
             <artifactId>module-oa</artifactId>
             <version>2.0.2</version>
-            <scope>compile</scope>
         </dependency>
 
         <dependency>
@@ -261,6 +259,12 @@
             </properties>
         </profile>
         <profile>
+            <id>preprod</id>
+            <properties>
+                <activatedProperties>preprod</activatedProperties>
+            </properties>
+        </profile>
+        <profile>
             <id>wps</id>
             <properties>
                 <activatedProperties>wps</activatedProperties>

+ 0 - 70
jeecg-boot-module-system/src/main/java/org/jeecg/JeecgOneToMainUtil.java

@@ -1,70 +0,0 @@
-package org.jeecg;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.jeecgframework.codegenerate.generate.impl.CodeGenerateOneToMany;
-import org.jeecgframework.codegenerate.generate.pojo.onetomany.MainTableVo;
-import org.jeecgframework.codegenerate.generate.pojo.onetomany.SubTableVo;
-
-/**
- * 代码生成器入口【一对多】
- * 【 GUI模式已弃用,请转移Online模式进行代码生成 】
- * @Author 张代浩
- * @site www.jeecg.org
- *
- */
-public class JeecgOneToMainUtil {
-
-	/**
-	 * 一对多(父子表)数据模型,生成方法
-	 * @param args
-	 */
-	public static void main(String[] args) {
-		//第一步:设置主表配置
-		MainTableVo mainTable = new MainTableVo();
-		mainTable.setTableName("jeecg_order_main");//表名
-		mainTable.setEntityName("GuiTestOrderMain");	 //实体名
-		mainTable.setEntityPackage("gui");	 //包名
-		mainTable.setFtlDescription("GUI订单管理");	 //描述
-
-		//第二步:设置子表集合配置
-		List<SubTableVo> subTables = new ArrayList<SubTableVo>();
-		//[1].子表一
-		SubTableVo po = new SubTableVo();
-		po.setTableName("jeecg_order_customer");//表名
-		po.setEntityName("GuiTestOrderCustom");	    //实体名
-		po.setEntityPackage("gui");	        //包名
-		po.setFtlDescription("客户明细");       //描述
-		//子表外键参数配置
-		/*说明:
-		 * a) 子表引用主表主键ID作为外键,外键字段必须以_ID结尾;
-		 * b) 主表和子表的外键字段名字,必须相同(除主键ID外);
-		 * c) 多个外键字段,采用逗号分隔;
-		 */
-		po.setForeignKeys(new String[]{"order_id"});
-		subTables.add(po);
-		//[2].子表二
-		SubTableVo po2 = new SubTableVo();
-		po2.setTableName("jeecg_order_ticket");		//表名
-		po2.setEntityName("GuiTestOrderTicket");			//实体名
-		po2.setEntityPackage("gui"); 				//包名
-		po2.setFtlDescription("产品明细");			//描述
-		//子表外键参数配置
-		/*说明:
-		 * a) 子表引用主表主键ID作为外键,外键字段必须以_ID结尾;
-		 * b) 主表和子表的外键字段名字,必须相同(除主键ID外);
-		 * c) 多个外键字段,采用逗号分隔;
-		 */
-		po2.setForeignKeys(new String[]{"order_id"});
-		subTables.add(po2);
-		mainTable.setSubTables(subTables);
-
-		//第三步:一对多(父子表)数据模型,代码生成
-		try {
-			new CodeGenerateOneToMany(mainTable,subTables).generateCodeFile(null);
-		} catch (Exception e) {
-			e.printStackTrace();
-		}
-	}
-}

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

@@ -62,7 +62,7 @@ public class AiKuaishouAdvertiserStrategyController {
         QueryWrapper<AiKuaishouAdvertiserStrategy> queryWrapper = QueryGenerator.initQueryWrapper(aiKuaishouAdvertiserStrategy, req.getParameterMap());
         LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         String roleCode = sysRoleService.getRoleCodeByUserId(user.getId());
-        if(!CtopRoleCodeConstant.COMMON_ROLE_CODE_ADMIN.equals(roleCode)){
+        if (!CtopRoleCodeConstant.COMMON_ROLE_CODE_ADMIN.equals(roleCode)) {
             queryWrapper.eq("user_id", user.getId());
         }
         Page<AiKuaishouAdvertiserStrategy> page = new Page<>(pageNo, pageSize);
@@ -98,22 +98,25 @@ public class AiKuaishouAdvertiserStrategyController {
         try {
             Long accountId = aiKuaishouAdvertiserStrategy.getAccountId();
             AiKuaishouAdvertiserStrategy getEntity = aiKuaishouAdvertiserStrategyService.getByAccountId(accountId);
-            if(null!=getEntity){
+            if (null != getEntity) {
                 result.error500("该账户配置信息已经被创建");
                 return result;
             }
             UserAllocation allocation = allocationService.getByAccountId(accountId);
-            if(null!=allocation){
+            if (null != allocation) {
                 aiKuaishouAdvertiserStrategy.setUserId(allocation.getUserId());
             }
             aiKuaishouAdvertiserStrategy.setDescription(aiKuaishouAdvertiserStrategy.getDescription().trim());
             Integer singleAppId = aiKuaishouAdvertiserStrategy.getSingleAppid();
             if (null != singleAppId && singleAppId == 1) {
-                Integer appId = Integer.parseInt(JSONArray.parseArray(aiKuaishouAdvertiserStrategy.getAppIdArray()).getString(0));
-                aiKuaishouAdvertiserStrategy.setAppId(appId);
+                if (aiKuaishouAdvertiserStrategy.getCampaignType() == 2 || aiKuaishouAdvertiserStrategy.getCampaignType() == 7) {
+                    Integer appId = Integer.parseInt(JSONArray.parseArray(aiKuaishouAdvertiserStrategy.getAppIdArray()).getString(0));
+                    aiKuaishouAdvertiserStrategy.setAppId(appId);
+                }
+
             }
             aiKuaishouAdvertiserStrategyService.save(aiKuaishouAdvertiserStrategy);
-            Thread thread = new Thread(){
+            Thread thread = new Thread() {
                 @Override
                 public void run() {
                     kuaishouVideoRelateCreativesService.videoRelateCreatives(aiKuaishouAdvertiserStrategy.getAccountId());
@@ -127,6 +130,7 @@ public class AiKuaishouAdvertiserStrategyController {
         }
         return result;
     }
+
     /**
      * 编辑
      *
@@ -141,10 +145,13 @@ public class AiKuaishouAdvertiserStrategyController {
             result.error500("未找到对应实体");
         } else {
             Integer singleAppId = aiKuaishouAdvertiserStrategy.getSingleAppid();
-            if (null != singleAppId && singleAppId == 1) {
-                Integer appId = Integer.parseInt(JSONArray.parseArray(aiKuaishouAdvertiserStrategy.getAppIdArray()).getString(0));
-                aiKuaishouAdvertiserStrategy.setAppId(appId);
+            if (aiKuaishouAdvertiserStrategy.getCampaignType() == 2 || aiKuaishouAdvertiserStrategy.getCampaignType() == 7) {
+                if (null != singleAppId && singleAppId == 1) {
+                    Integer appId = Integer.parseInt(JSONArray.parseArray(aiKuaishouAdvertiserStrategy.getAppIdArray()).getString(0));
+                    aiKuaishouAdvertiserStrategy.setAppId(appId);
+                }
             }
+
             boolean ok = aiKuaishouAdvertiserStrategyService.updateById(aiKuaishouAdvertiserStrategy);
             if (ok) {
                 result.success("修改成功!");
@@ -261,12 +268,12 @@ public class AiKuaishouAdvertiserStrategyController {
     }
 
     @GetMapping(value = "testCreate")
-    public Map<String,Object> testCreate(Long accountId){
+    public Map<String, Object> testCreate(Long accountId) {
         return aiKuaishouAdvertiserStrategyService.testCreate(accountId);
     }
 
     @GetMapping(value = "aiHistoricalMissingMaterial")
-    public Map<String,Object> aiHistoricalMissingMaterial(Long accountId){
+    public Map<String, Object> aiHistoricalMissingMaterial(Long accountId) {
         return aiKuaishouAdvertiserStrategyService.aiHistoricalMissingMaterial(accountId);
     }
 }

+ 202 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/BytedanceCustomerDdTbtjDataController.java

@@ -0,0 +1,202 @@
+package org.jeecg.modules.ctop.controller;
+
+import cn.com.ctop.common.module.annotation.AutoLog;
+import cn.com.ctop.common.module.utils.QueryGenerator;
+import com.alibaba.excel.event.AnalysisEventListener;
+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.modules.ctop.entity.BytedanceCustomerDdTbtjData;
+import org.jeecg.modules.ctop.service.IBytedanceCustomerDdTbtjDataService;
+import org.jeecg.modules.excelutil.BytedanceCustomTbtjDataExcelListener;
+import org.jeecg.modules.excelutil.ExcelUtils;
+import org.jeecg.modules.excelutil.entity.BytedanceCustomTbtjDataEntity;
+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 javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.Map;
+
+/**
+ * 淘宝特价版客户反馈数据
+ * @author jeecg-boot
+ * @date   2021-04-22
+ * @version V1.0
+ */
+@Slf4j
+@Api(tags="淘宝特价版客户反馈数据")
+@RestController
+@RequestMapping("/ctop/bytedanceCustomerDdTbtjData")
+public class BytedanceCustomerDdTbtjDataController {
+	@Autowired
+	private IBytedanceCustomerDdTbtjDataService bytedanceCustomerDdTbtjDataService;
+
+	/**
+	  * 分页列表查询
+	 * @param bytedanceCustomerDdTbtjData
+	 * @param pageNo
+	 * @param pageSize
+	 * @param req
+	 * @return
+	 */
+	@ApiOperation(value="淘宝特价版客户反馈数据-分页列表查询", notes="淘宝特价版客户反馈数据-分页列表查询")
+	@GetMapping(value = "/list")
+	public Result<IPage<BytedanceCustomerDdTbtjData>> queryPageList(BytedanceCustomerDdTbtjData bytedanceCustomerDdTbtjData,
+																	@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
+																	@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
+																	HttpServletRequest req) {
+		Result<IPage<BytedanceCustomerDdTbtjData>> result = new Result<>();
+		QueryWrapper<BytedanceCustomerDdTbtjData> queryWrapper = QueryGenerator.initQueryWrapper(bytedanceCustomerDdTbtjData, req.getParameterMap());
+		queryWrapper.orderByDesc("state_date");
+		Page<BytedanceCustomerDdTbtjData> page = new Page<BytedanceCustomerDdTbtjData>(pageNo, pageSize);
+		IPage<BytedanceCustomerDdTbtjData> pageList = bytedanceCustomerDdTbtjDataService.page(page, queryWrapper);
+		result.setSuccess(true);
+		result.setResult(pageList);
+		return result;
+	}
+
+	/**
+	  *   添加
+	 * @param bytedanceCustomerDdTbtjData
+	 * @return
+	 */
+	@AutoLog(value = "淘宝特价版客户反馈数据-添加")
+	@ApiOperation(value="淘宝特价版客户反馈数据-添加", notes="淘宝特价版客户反馈数据-添加")
+	@PostMapping(value = "/add")
+	public Result<BytedanceCustomerDdTbtjData> add(@RequestBody BytedanceCustomerDdTbtjData bytedanceCustomerDdTbtjData) {
+		Result<BytedanceCustomerDdTbtjData> result = new Result<>();
+		try {
+			bytedanceCustomerDdTbtjDataService.save(bytedanceCustomerDdTbtjData);
+			result.success("添加成功!");
+		} catch (Exception e) {
+			log.error(e.getMessage(),e);
+			result.error500("操作失败");
+		}
+		return result;
+	}
+
+	/**
+	  *  编辑
+	 * @param bytedanceCustomerDdTbtjData
+	 * @return
+	 */
+	@AutoLog(value = "淘宝特价版客户反馈数据-编辑")
+	@ApiOperation(value="淘宝特价版客户反馈数据-编辑", notes="淘宝特价版客户反馈数据-编辑")
+	@PutMapping(value = "/edit")
+	public Result<BytedanceCustomerDdTbtjData> edit(@RequestBody BytedanceCustomerDdTbtjData bytedanceCustomerDdTbtjData) {
+		Result<BytedanceCustomerDdTbtjData> result = new Result<BytedanceCustomerDdTbtjData>();
+		BytedanceCustomerDdTbtjData bytedanceCustomerDdTbtjDataEntity = bytedanceCustomerDdTbtjDataService.getById(bytedanceCustomerDdTbtjData.getId());
+		if(bytedanceCustomerDdTbtjDataEntity==null) {
+			result.error500("未找到对应实体");
+		}else {
+			boolean ok = bytedanceCustomerDdTbtjDataService.updateById(bytedanceCustomerDdTbtjData);
+			if(ok) {
+				result.success("修改成功!");
+			}
+		}
+
+		return result;
+	}
+
+	/**
+	  *   通过id删除
+	 * @param id
+	 * @return
+	 */
+	@AutoLog(value = "淘宝特价版客户反馈数据-通过id删除")
+	@ApiOperation(value="淘宝特价版客户反馈数据-通过id删除", notes="淘宝特价版客户反馈数据-通过id删除")
+	@DeleteMapping(value = "/delete")
+	public Result<?> delete(@RequestParam(name="id",required=true) String id) {
+		try {
+			bytedanceCustomerDdTbtjDataService.removeById(id);
+		} catch (Exception e) {
+			log.error("删除失败",e.getMessage());
+			return Result.error("删除失败!");
+		}
+		return Result.ok("删除成功!");
+	}
+
+	/**
+	  *  批量删除
+	 * @param ids
+	 * @return
+	 */
+	@AutoLog(value = "淘宝特价版客户反馈数据-批量删除")
+	@ApiOperation(value="淘宝特价版客户反馈数据-批量删除", notes="淘宝特价版客户反馈数据-批量删除")
+	@DeleteMapping(value = "/deleteBatch")
+	public Result<BytedanceCustomerDdTbtjData> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
+		Result<BytedanceCustomerDdTbtjData> result = new Result<>();
+		if(ids==null || "".equals(ids.trim())) {
+			result.error500("参数不识别!");
+		}else {
+			this.bytedanceCustomerDdTbtjDataService.removeByIds(Arrays.asList(ids.split(",")));
+			result.success("删除成功!");
+		}
+		return result;
+	}
+
+	/**
+	  * 通过id查询
+	 * @param id
+	 * @return
+	 */
+	@AutoLog(value = "淘宝特价版客户反馈数据-通过id查询")
+	@ApiOperation(value="淘宝特价版客户反馈数据-通过id查询", notes="淘宝特价版客户反馈数据-通过id查询")
+	@GetMapping(value = "/queryById")
+	public Result<BytedanceCustomerDdTbtjData> queryById(@RequestParam(name="id",required=true) String id) {
+		Result<BytedanceCustomerDdTbtjData> result = new Result<>();
+		BytedanceCustomerDdTbtjData bytedanceCustomerDdTbtjData = bytedanceCustomerDdTbtjDataService.getById(id);
+		if(bytedanceCustomerDdTbtjData==null) {
+			result.error500("未找到对应实体");
+		}else {
+			result.setResult(bytedanceCustomerDdTbtjData);
+			result.setSuccess(true);
+		}
+		return result;
+	}
+  /**
+      * 通过excel导入数据
+   *
+   * @param request
+   * @param response
+   * @return
+   */
+  @PostMapping(value = "/importExcel")
+  public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
+	  //1.读Excel
+	  MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
+	  Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
+	  for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
+		  FileInputStream fis = null;
+		  try {
+			  MultipartFile file = entity.getValue();
+			  fis = (FileInputStream) file.getInputStream();
+			  AnalysisEventListener listener = new BytedanceCustomTbtjDataExcelListener();
+			  Boolean flag = ExcelUtils.readExcel(fis, BytedanceCustomTbtjDataEntity.class, listener);
+			  System.out.println("导入是否成功:" + flag);
+		  } catch (Exception e) {
+			  e.printStackTrace();
+		  } finally {
+			  if (fis != null) {
+				  try {
+					  fis.close();
+				  } catch (IOException e) {
+					  e.printStackTrace();
+				  }
+			  }
+		  }
+	  }
+	  return Result.ok("文件导入成功!");
+  }
+
+}

+ 135 - 70
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialInfoController.java

@@ -6,7 +6,10 @@ import cn.com.ctop.common.module.entity.*;
 import cn.com.ctop.common.module.enums.MaterialSupplierEnum;
 import cn.com.ctop.common.module.service.*;
 import cn.com.ctop.common.module.utils.*;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouReportDailyMaterialService;
+
+import cn.com.ctop.toutiao.modules.material.entity.BytedanceVideoSlogenInfo;
+import cn.com.ctop.toutiao.modules.material.service.IBytedanceVideoSlogenInfoService;
+import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -61,7 +64,15 @@ public class MaterialInfoController {
     @Autowired
     private IMaterialImageInfoService iMaterialImageInfoService;
     @Autowired
-    private IKuaiShouReportDailyMaterialService kuaiShouReportDailyMaterialService;
+    private IProjectService projectService;
+    @Autowired
+    private IMessageTemplate messageTemplate;
+    @Autowired
+    private ISysRoleService roleService;
+    @Autowired
+    private ISendMessageService sendMessageService;
+    @Autowired
+    private IBytedanceVideoSlogenInfoService slogenInfoService;
 
 
     @GetMapping("/supplierWatermark")
@@ -104,12 +115,9 @@ public class MaterialInfoController {
         return result;
     }
 
-
     @PostMapping("/correlationUpload")
     public Map<String, Object> insertFile(@RequestBody JSONObject json) {
-        LoginUser user = (LoginUser) SecurityUtils.getSubject()
-                .getPrincipal();
-
+        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         json.put("userId", user.getId());
         return materialInfoService.correlationUpload(json);
     }
@@ -132,18 +140,17 @@ public class MaterialInfoController {
         return materialInfoService.report(userId);
     }
 
-
     @GetMapping(value = "/getDetail")
     public JSONObject getDetail(String materialId) {
         return materialInfoService.getDetail(materialId);
-
     }
 
     @PostMapping("watermark")
     public Result<Object> watermarkVideo(@RequestParam(name = "id") String id, @RequestParam(name = "watermarkTemplateId") Long watermarkTemplateId) {
         Result<Object> result = new Result<>();
         LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
-        materialInfoService.watermarkVideo(id, watermarkTemplateId, sysUser.getId());
+        Thread thread = new Thread(()-> materialInfoService.watermarkVideo(id, watermarkTemplateId, sysUser.getId()));
+        thread.start();
         result.setCode(200);
         result.setSuccess(true);
         result.setMessage("水印合成任务执行成功,请稍后查看");
@@ -160,7 +167,6 @@ public class MaterialInfoController {
         return result;
     }
 
-
     @GetMapping("/excellent/list")
     public Result<IPage<MaterialInfo>> excellentList(MaterialInfo materialInfo,
                                                      @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@@ -189,23 +195,18 @@ public class MaterialInfoController {
         return result;
     }
 
-    @Autowired
-    private ISysRoleService roleService;
-
+    @Deprecated
     @GetMapping(value = "/list")
     public Result<IPage<MaterialInfo>> queryPageList(MaterialInfo materialInfo,
                                                      @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                      @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                      HttpServletRequest req) {
-
         Result<IPage<MaterialInfo>> result = new Result<>();
         String materialName = materialInfo.getMaterialName();
         String startDate = materialInfo.getStartDate();
         String endDate = materialInfo.getEndDate();
         materialInfo.setStartDate(null);
         materialInfo.setEndDate(null);
-
-
         materialInfo.setMaterialName(null);
         QueryWrapper<MaterialInfo> queryWrapper = new QueryWrapper<>();
         materialInfo.setCreateTime(null);
@@ -272,7 +273,6 @@ public class MaterialInfoController {
                     material.setByteDance(JSONObject.parseObject(byteDanceString));
                 }
 
-
                 Project project = projectService.getById(material.getProjectId());
                 if (!Check.isNull(project)) {
                     material.setMediaId(project.getMediaId());
@@ -283,17 +283,9 @@ public class MaterialInfoController {
                 imageInfoQueryWrapper.eq("video_id", material.getCode());
                 imageInfoQueryWrapper.eq("status", 0);
                 List<MaterialImageInfo> imageInfoList = iMaterialImageInfoService.list(imageInfoQueryWrapper);
-                if (Check.isNull(imageInfoList)) {
-                    material.setWhetherUnaudited(false);
-                } else {
-                    material.setWhetherUnaudited(true);
-                }
-
+                material.setWhetherUnaudited(!Check.isNull(imageInfoList));
             }
-
-
         }
-
         result.setSuccess(true);
         result.setResult(pageList);
         return result;
@@ -337,7 +329,6 @@ public class MaterialInfoController {
         }
     }
 
-
     @AutoLog(value = "素材信息-分页列表查询")
     @ApiOperation(value = "素材信息-分页列表查询", notes = "素材信息-分页列表查询")
     @GetMapping(value = "/supplierList")
@@ -345,8 +336,6 @@ public class MaterialInfoController {
                                                     @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                     @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                     HttpServletRequest req) {
-
-
         Result<IPage<MaterialInfo>> result = new Result<>();
         String materialName = materialInfo.getMaterialName();
         materialInfo.setMaterialName(null);
@@ -356,7 +345,6 @@ public class MaterialInfoController {
         materialInfo.setEndDate(null);
 
         QueryWrapper<MaterialInfo> queryWrapper = new QueryWrapper<>();
-
         if (!Check.isNull(materialInfo.getUserId())) {
             String roleCode = roleService.getRoleCodeByUserId(materialInfo.getUserId());
             if (CtopRoleCodeConstant.COMMON_ROLE_CODE_ADMIN.equals(roleCode)) {
@@ -408,7 +396,6 @@ public class MaterialInfoController {
 
             }
 
-
         }
 
         result.setSuccess(true);
@@ -468,22 +455,12 @@ public class MaterialInfoController {
     }
 
     /**
-     * 编辑
-     *
+     * 头条素材信息编辑
      * @param materialInfo
      * @return
      */
-    @Autowired
-    private IProjectService projectService;
-    @Autowired
-    private IMessageTemplate messageTemplate;
-    @Autowired
-    private ISendMessageService sendMessageService;
-
-    @AutoLog(value = "素材信息-编辑")
-    @ApiOperation(value = "素材信息-编辑", notes = "素材信息-编辑")
-    @PutMapping(value = "/edit")
-    public Result<MaterialInfo> edit(@RequestBody MaterialInfo materialInfo) {
+    @PutMapping(value = "/bytedance/edit")
+    public Result<MaterialInfo> bytedanceEdit(@RequestBody MaterialInfo materialInfo) {
         Result<MaterialInfo> result = new Result<>();
         MaterialInfo materialInfoEntity = materialInfoService.getById(materialInfo.getId());
         if (materialInfoEntity == null) {
@@ -517,7 +494,6 @@ public class MaterialInfoController {
             } else {
                 materialInfo.setCoverUrl(cutFrame.getUrl());
             }
-
         }
 
         //  修改素材库 相关联code
@@ -541,29 +517,14 @@ public class MaterialInfoController {
                 materialAscriptionService.update(updateMaterialAscription, ascriptionQueryWrapper);
             }
         }
-
-        //  审核通过自动同步到到媒体后台
-       /* Long projectId = materialInfoEntity.getProjectId();
-        Project project = projectService.getById(projectId);
-        if (!Check.isNull(projectId)) {
-            if ("2".equals(project.getMediaId())) {
-                if (!Check.isNull(materialInfo.getStatus())) {
-                    Integer status = materialInfo.getStatus();
-                    if (status == 1) {
-                        Thread thread = new Thread() {
-                            @Override
-                            public void run() {
-                                log.info("开始自动同步素材,code:{}", materialInfoEntity.getCode());
-                                uploadService.upload(materialInfoEntity);
-                            }
-                        };
-                        thread.start();
-                    }
-                }
+        //添加视频文案信息
+        if(!Check.isNull(materialInfo.getSlogans())){
+            JSONArray slogans = materialInfo.getSlogans();
+            if(null!=slogans&&!slogans.isEmpty()){
+                LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+                slogenInfoService.insertSlogans(materialInfoEntity.getCode(),slogans,user.getId());
             }
-
-        }*/
-
+        }
         boolean ok = materialInfoService.updateById(materialInfo);
         if (ok) {
             result.success("修改成功!");
@@ -579,8 +540,6 @@ public class MaterialInfoController {
         return result;
 
     }
-
-
     /**
      * 通过id删除
      *
@@ -640,12 +599,19 @@ public class MaterialInfoController {
     @AutoLog(value = "素材信息-通过id查询")
     @ApiOperation(value = "素材信息-通过id查询", notes = "素材信息-通过id查询")
     @GetMapping(value = "/queryById")
-    public Result<MaterialInfo> queryById(@RequestParam(name = "id", required = true) String id) {
+    public Result<MaterialInfo> queryById(@RequestParam(name = "id") String id) {
         Result<MaterialInfo> result = new Result<>();
         MaterialInfo materialInfo = materialInfoService.getById(id);
         if (materialInfo == null) {
             result.error500("未找到对应实体");
         } else {
+            //查询素材下关联的头条文案信息
+            List<BytedanceVideoSlogenInfo>slogenInfos = slogenInfoService.listByParams(materialInfo.getCode(),1);
+            JSONArray slogenArray = new JSONArray();
+            if(null!=slogenInfos&&!slogenInfos.isEmpty()){
+                slogenArray.addAll(slogenInfos);
+            }
+            materialInfo.setSlogans(slogenArray);
             result.setResult(materialInfo);
             result.setSuccess(true);
         }
@@ -696,6 +662,105 @@ public class MaterialInfoController {
         return result;
     }
 
+    @AutoLog(value = "素材信息-编辑")
+    @ApiOperation(value = "素材信息-编辑", notes = "素材信息-编辑")
+    @PutMapping(value = "/edit")
+    public Result<MaterialInfo> edit(@RequestBody MaterialInfo materialInfo) {
+        Result<MaterialInfo> result = new Result<>();
+        MaterialInfo materialInfoEntity = materialInfoService.getById(materialInfo.getId());
+        if (materialInfoEntity == null) {
+            return result.error500("未找到对应实体");
+        }
+        String url = materialInfo.getUrl();
+        if (!Check.isNull(url)) {
+            if (!url.contains(KuaishouInterfaceConstant.HTTPS_PREFIX)) {
+                url = KuaishouInterfaceConstant.HTTPS_PREFIX + url;
+            }
+            materialInfo.setUrl(url);
+            materialInfo.setCreateTime(new Date());
+            MaterialCutFrame cutFrame = materialCutFrameService.getCutFrameByCode(materialInfo.getCode());
+            if (Check.isNull(cutFrame)) {
+                String videoUrl = URLDecoder.decode(url).replace("https://media-1301855440.cos.ap-chongqing.myqcloud.com/", "");
+                String loadImage = "cutFrame/" + materialInfo.getCode() + "/zero.jpg";
+                String coverUrl = CloudVideoProcessUtil.videoCutPictureHandle(videoUrl, loadImage);
+                materialInfo.setCoverUrl(coverUrl);
+                Thread thread = new Thread() {
+                    @Override
+                    public void run() {
+                        try {
+                            log.info("开始抽帧,code:{}", materialInfo.getCode());
+                            materialCutFrameService.getTencentCutFrame(videoUrl, materialInfo.getCode(), coverUrl);
+                        } catch (Exception e) {
+                            e.printStackTrace();
+                        }
+                    }
+                };
+                thread.start();
+            } else {
+                materialInfo.setCoverUrl(cutFrame.getUrl());
+            }
+
+        }
+
+        //  修改素材库 相关联code
+        if (!Check.isNull(materialInfo.getCode())) {
+            String code = materialInfoEntity.getCode();
+            if (!Check.isNull(code)) {
+                MaterialTag updateMaterialTag = new MaterialTag();
+                updateMaterialTag.setMaterialId(materialInfo.getCode());
+                QueryWrapper<MaterialTag> tagQueryWrapper = new QueryWrapper<>();
+                tagQueryWrapper.eq("material_id", code);
+                materialTagService.update(updateMaterialTag, tagQueryWrapper);
+                MaterialParameter updateParameter = new MaterialParameter();
+                updateParameter.setMaterialId(materialInfo.getCode());
+                QueryWrapper<MaterialParameter> parameterQueryWrapper = new QueryWrapper<>();
+                parameterQueryWrapper.eq("material_id", code);
+                materialParameterService.update(updateParameter, parameterQueryWrapper);
+                MaterialAscription updateMaterialAscription = new MaterialAscription();
+                updateMaterialAscription.setMaterialId(materialInfo.getCode());
+                QueryWrapper<MaterialAscription> ascriptionQueryWrapper = new QueryWrapper<>();
+                ascriptionQueryWrapper.eq("material_id", code);
+                materialAscriptionService.update(updateMaterialAscription, ascriptionQueryWrapper);
+            }
+        }
+
+        //  审核通过自动同步到到媒体后台
+       /* Long projectId = materialInfoEntity.getProjectId();
+        Project project = projectService.getById(projectId);
+        if (!Check.isNull(projectId)) {
+            if ("2".equals(project.getMediaId())) {
+                if (!Check.isNull(materialInfo.getStatus())) {
+                    Integer status = materialInfo.getStatus();
+                    if (status == 1) {
+                        Thread thread = new Thread() {
+                            @Override
+                            public void run() {
+                                log.info("开始自动同步素材,code:{}", materialInfoEntity.getCode());
+                                uploadService.upload(materialInfoEntity);
+                            }
+                        };
+                        thread.start();
+                    }
+                }
+            }
+
+        }*/
+
+        boolean ok = materialInfoService.updateById(materialInfo);
+        if (ok) {
+            result.success("修改成功!");
+        }
+
+        Integer status = materialInfo.getStatus();
+        // 如果状态为2 审核拒绝 给上传人发送消息
+        if (status == 2) {
+            Project project = projectService.getById(materialInfoEntity.getProjectId());
+            String text = messageTemplate.getMaterialRejectTemplate(project.getProjectName(), materialInfoEntity.getMaterialName(), materialInfo.getRefuseReason());
+            sendMessageService.sendMessage(materialInfoEntity.getUserId(), text);
+        }
+        return result;
+    }
+
     /**
      * adlab 新加查询素材库接口
      */

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

@@ -149,6 +149,11 @@ public class ProjectMemberController {
     }
 
 
+    /**
+     * 获取项目以及账户信息
+     * @param requestJson
+     * @return
+     */
     @PostMapping(value = "/participateListByMediaId")
     public Result<List<JSONObject>> participateListByMediaId(@RequestBody JSONObject requestJson) {
         Result<List<JSONObject>> result = new Result<>();
@@ -168,13 +173,17 @@ public class ProjectMemberController {
                     mediaIds.add(3);
                 }
             }
+            //查询用户角色
             String roleCode = sysRoleService.getRoleCodeByUserId(userId);
+            //角色为 管理员 || 销售 || 媒介 查询全部
             if ("admin".equals(roleCode) || roleCode.contains("sale") || "meidaManager".equals(roleCode)) {
                 userId = null;
             }
+            //查询项目信息以及广告主
             List<JSONObject> projectList = projectMemberService.getProjectByUserIdAndMediaIds(userId, mediaIds);
             List<JSONObject> haveList = new ArrayList<>();
             if (!Check.isNull(projectList)) {
+                //项目id 查询账户人员信息
                 Map<Long, List<JSONObject>> accountMap = userAllocationService.getAccountListByProjectList(projectList);
                 for (int i = 0; i < projectList.size(); i++) {
                     JSONObject project = projectList.get(i);

+ 310 - 61
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/TestController.java

@@ -12,13 +12,20 @@ import cn.com.ctop.crawler.modules.douyin.service.DouyinMusicService;
 import cn.com.ctop.kuaishou.modules.ai.entity.AiKuaishouAdvertiserStrategy;
 import cn.com.ctop.kuaishou.modules.ai.service.IAiKuaishouAdvertiserStrategyService;
 import cn.com.ctop.kuaishou.modules.ai.service.IAiKuaishouCreateCreativeService;
+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.KuaiShouGroup;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaishouTemplate;
 import cn.com.ctop.kuaishou.modules.batch.service.*;
 import cn.com.ctop.kuaishou.modules.graphql.service.IKuaishouWebInterfaceService;
 import cn.com.ctop.kuaishou.modules.material.entity.KuaishouAccessToken;
 import cn.com.ctop.kuaishou.modules.material.entity.KuaishouResultToken;
+import cn.com.ctop.kuaishou.modules.report.entity.KuaiShouProjectData;
 import cn.com.ctop.kuaishou.modules.report.service.IKuaiShouDailyAgentService;
+import cn.com.ctop.kuaishou.modules.report.service.IKuaiShouProjectDataService;
 import cn.com.ctop.kuaishou.modules.report.service.IKuaishouAudienceReportDailyService;
+import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportHourlyGroupService;
+import cn.com.ctop.manage.modules.material.service.IMaterialUploadService;
 import cn.com.ctop.toutiao.modules.link.service.IETLReportBytedanceVideoService;
 import cn.com.ctop.toutiao.modules.material.service.IByteDanceAdvertiserDataService;
 import cn.com.ctop.toutiao.modules.material.service.IBytedanceEffectVideoInfoService;
@@ -33,6 +40,7 @@ import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.util.DateUtils;
 import org.quartz.JobExecutionException;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
@@ -92,7 +100,7 @@ public class TestController {
     @Autowired
     private IKuaiShouHistoryReportTaskService kuaiShouHistoryReportTaskService;
 
-    static ExecutorService executorService = Executors.newFixedThreadPool(15);
+    static ExecutorService executorService = Executors.newFixedThreadPool(5);
     static ExecutorService suzhaoService = Executors.newFixedThreadPool(5);
     @Autowired
     private IKuaiShouDailyAgentService dailyAgentService;
@@ -111,23 +119,288 @@ public class TestController {
     @Autowired
     private ICtopOauthTokenService tokenService;
 
+    @Autowired
+    private IKuaiShouProjectDataService kuaiShouProjectDataService;
+    @Autowired
+    private IKuaishouReportHourlyGroupService hourlyGroupService;
+    @Autowired
+    private IKuaiShouReportDailyMaterialService kuaiShouReportDailyMaterialService;
+
+    @Autowired
+    private IKuaiShouCreativeService creativeService;
+    @Autowired
+    private IKuaiShouGroupService groupService;
+
+    @Autowired
+    private IBatchService batchService;
+    static ExecutorService videoService = Executors.newFixedThreadPool(3);
+    @Autowired
+    private IMaterialUploadService materialUploadService;
+
+    @Value("${xxl-job.requestUrl}")
+    private String jobUrl;
+
+    @GetMapping("/uploadVideo")
+    public String uploadVideo(Long projectId) {
+
+        System.err.println(jobUrl + "/jeecg-boot/ai/create/customCreativeLimit");
+
+        //  832
+        JSONArray idList = materialInfoService.getIdListByProject(832L);
+        JSONArray accountArray = new JSONArray();
+
+        accountArray.add(9549277L);
+        accountArray.add(9635234L);
+        accountArray.add(9767697L);
+        accountArray.add(9825207L);
+
+
+        materialUploadService.uploadAccount("2", idList, accountArray, "2e3b982046a44b5faadaa77a7c0da114", true);
+        return "success";
+    }
+
+
+    @GetMapping(value = "/getProgramCreative")
+    public void getProgramCreative() {
+        List<Long> list = new ArrayList();
+        list.add(10045052L);
+        list.add(10045823L);
+        list.add(10045830L);
+        list.add(10045831L);
+
+        for (int i = 0; i < list.size(); i++) {
+            Long accountId = list.get(i);
+            CtopOauthToken oauthToken = oauthTokenService.getTokenByAccountId(accountId);
+            creativeService.getProgramCreative(oauthToken, 1);
+        }
+
+
+    }
+
+
+    @GetMapping(value = "/campaignList")
+    public void campaignList() {
+        List<Long> list = new ArrayList();
+        list.add(10045052L);
+        list.add(10045823L);
+        list.add(10045830L);
+        list.add(10045831L);
+        for (int i = 0; i < list.size(); i++) {
+            Long accountId = list.get(i);
+            CtopOauthToken oauthToken = oauthTokenService.getTokenByAccountId(accountId);
+            // kuaishouInterfaceService.getCampaignList(oauthToken, null, null);
+            videoService.submit(new Runnable() {
+                @Override
+                public void run() {
+                    try {
+                        kuaishouInterfaceService.getCampaignList(oauthToken, null, null);
+                        //   kuaishouInterfaceService.getGroupList(oauthToken, null, null);
+                        //     kuaishouInterfaceService.getCreativeList(oauthToken, null, null);
+                        Thread.sleep(1500);
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    }
+                }
+            });
+
+        }
+
+    }
+
+
+    @GetMapping(value = "/creativeList")
+    public void creativeList() {
+        List<Long> list = new ArrayList();
+        list.add(10045052L);
+        list.add(10045823L);
+        list.add(10045830L);
+        list.add(10045831L);
+        for (int i = 0; i < list.size(); i++) {
+            Long accountId = list.get(i);
+            CtopOauthToken oauthToken = oauthTokenService.getTokenByAccountId(accountId);
+            QueryWrapper<KuaiShouCampaign> campaignQueryWrapper = new QueryWrapper<>();
+            campaignQueryWrapper.eq("account_id", accountId);
+
+            List<KuaiShouCampaign> list1 = campaignService.list(campaignQueryWrapper);
+            for (KuaiShouCampaign campaign : list1) {
+                executorService.submit(new Runnable() {
+                    @Override
+                    public void run() {
+                        kuaishouInterfaceService.getCreativeList(oauthToken, null, null);
+                    }
+                });
+                try {
+                    Thread.sleep(400L);
+                } catch (InterruptedException e) {
+                    e.printStackTrace();
+                }
+            }
+
+
+        }
+
+    }
+
+
+    @GetMapping(value = "/updateUnit")
+    public void updateUnit() throws Exception {
+        List<Long> list = new ArrayList();
+        list.add(9556344L);
+        list.add(9743738L);
+        list.add(9743727L);
+        list.add(9812671L);
+        list.add(9838554L);
+        list.add(9743746L);
+        list.add(9767055L);
+        list.add(9556274L);
+        list.add(9767096L);
+        list.add(9792538L);
+        list.add(9766952L);
+        list.add(9677440L);
+        list.add(9677334L);
+        list.add(9556465L);
+        list.add(9677236L);
+        list.add(9556227L);
+        list.add(9556188L);
+        list.add(9556431L);
+        list.add(9677408L);
+        list.add(9677284L);
+
+        for (int i = 0; i < list.size(); i++) {
+            Long accountId = list.get(i);
+            CtopOauthToken oauthToken = oauthTokenService.getTokenByAccountId(accountId);
+            QueryWrapper<KuaiShouGroup> groupQueryWrapper = new QueryWrapper<>();
+            groupQueryWrapper.eq("account_id", accountId);
+            //      groupQueryWrapper.ne("schedule_time","000000111111111111111111000000111111111111111111000000111111111111111111000000111111111111111111000000111111111111111111000000111111111111111111000000111111111111111111");
+            //     groupQueryWrapper.eq("use_app_market", 1);
+            //    groupQueryWrapper.gt("cpa_bid", 19000);
+
+
+            List<KuaiShouGroup> list1 = groupService.list(groupQueryWrapper);
+          /*  for (KuaiShouGroup group : list1) {
+
+                JSONObject json = new JSONObject();
+                json.put("unitId", group.getUnitId());
+                json.put("useAppMarket", 0);
+                json.put("appStore", new JSONArray());
+                batchService.updateUnit(json, oauthToken);
+            }*/
+
+            for (KuaiShouGroup group : list1) {
+                executorService.submit(new Runnable() {
+                    @Override
+                    public void run() {
+                        try {
+                            JSONObject json = new JSONObject();
+                            json.put("unitId", group.getUnitId());
+                            json.put("cpaBid", 18 * 1000);
+                            //     json.put("gender", "2");
+                            batchService.updateUnit(json, oauthToken);
+                            Thread.sleep(1500);
+                        } catch (Exception e) {
+                            e.printStackTrace();
+                        }
+                    }
+                });
+
+
+            }
+
+
+        }
+
+
+    }
+
+
+    @GetMapping(value = "/updateCreative")
+    public void updateCreative() {
+        List<Long> list = new ArrayList();
+        list.add(10045052L);
+        list.add(10045823L);
+        list.add(10045830L);
+        list.add(10045831L);
+
+        for (int i = 0; i < list.size(); i++) {
+            Long accountId = list.get(i);
+            CtopOauthToken oauthToken = oauthTokenService.getTokenByAccountId(accountId);
+
+
+            QueryWrapper<KuaiShouCreative> creativeQueryWrapper = new QueryWrapper<>();
+            creativeQueryWrapper.eq("account_id", accountId);
+
+
+            List<KuaiShouCreative> creativeList = creativeService.list(creativeQueryWrapper);
+            for (KuaiShouCreative creative : creativeList) {
+                executorService.submit(new Runnable() {
+                    @Override
+                    public void run() {
+                        try {
+                            JSONObject json = new JSONObject();
+                            json.put("creativeId", creative.getCreativeId());
+                            String url = "https://click-wailaxin.1sapp.com/vendor/feedback/reportClick?platform=kuaishou&feedback_type=android&account_id=19&plan_id=__DID__&adgroup_id=__AID__&creative_id=__CID__&imei=__IMEI2__&mac=__MAC__&androidid=__ANDROIDID2__&ts=__TS__&ip=__IP__&ua=__UA__&callback=__CALLBACK__&oaid=__OAID__&app=dxqlb";
+
+                            if (creative.getCreativeMaterialType() == 1) {
+                                json.put("clickTrackUrl", url);
+                            } else if (creative.getCreativeMaterialType() == 4) {
+                                json.put("impressionUrl", url);
+                                json.put("clickTrackUrl", url);
+
+                            }
+                            JSONObject jsonObject = batchService.updateCreative(json, oauthToken);
+                            log.info("修改创意返回信息:creative:{},结果:{}", creative.getCreativeId(), jsonObject);
+                            Thread.sleep(1000L);
+                        } catch (Exception e) {
+                            e.printStackTrace();
+                        }
+                    }
+                });
+            }
+        }
+    }
+
 
     @GetMapping("/cleanNewlyData")
     public void cleanNewlyData(String startDate, String endDate) throws ParseException {
 
 
-        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
-        Date parse1 = simpleDateFormat.parse(startDate);
-        Date parse2 = simpleDateFormat.parse(endDate);
-     /*   CtopOauthToken token = new CtopOauthToken();
-        token.setAccountId(9791267L);
-        token.setAccessToken("b8ab3b361cd30339ef7e18dcc1305123");*/
+        String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
+        String yesterday = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -1);
+        //1:查询当日数据
+        QueryWrapper<KuaiShouProjectData> queryWrapper = new QueryWrapper();
+        queryWrapper.eq("project_status", 0);
+        List<KuaiShouProjectData> list = kuaiShouProjectDataService.list(queryWrapper);
+        if (Check.isNull(list)) {
+            return;
+        }
+        for (KuaiShouProjectData projectData : list) {
+            Long projectId = projectData.getProjectId();
+            if (Check.isNull(projectId)) {
+                continue;
+            }
+            QueryWrapper<UserAllocation> allocationQueryWrapper = new QueryWrapper<>();
+            allocationQueryWrapper.eq("project_id", projectId);
+            allocationQueryWrapper.eq("account_status", 0);
+            List<UserAllocation> accountIds = allocationService.list(allocationQueryWrapper);
+            if (Check.isNull(accountIds)) {
+                continue;
+            }
+            for (UserAllocation allocation : accountIds) {
+                CtopOauthToken token = tokenService.getTokenByAccountId(allocation.getAccountId());
+                if (Check.isNull(token)) {
+                    continue;
+                }
 
-        List<CtopOauthToken> ctopOauthTokens = tokenService.selectKuaiShouToken();
-        // kuaishouInterfaceService.getAdvertiserReportDaily(token, getDate, getDate, "adScene");
-        ctopOauthTokens.forEach(token -> executorService.submit(() -> {
-            kuaishouInterfaceService.getAdvertiserReportDaily(token, parse1, parse2, "adScene");
-        }));
+                executorService.submit(new Runnable() {
+                    @Override
+                    public void run() {
+                        kuaiShouReportDailyMaterialService.getMaterialReportByAccountIdAndStatDate(token.getAccountId(), token.getAccessToken(), yesterday, yesterday, "HOURLY", 1);
+
+                        //  hourlyGroupService.getAdvertiserGroupReportHourly(token.getAccountId(), token.getAccessToken(), yesterday, yesterday);
+                    }
+                });
+            }
+        }
 
 
     }
@@ -748,39 +1021,17 @@ public class TestController {
     }
 
 
-    @GetMapping(value = "/createTask")
-    public String createTask(Long accountId) {
-        Result<String> result = new Result<String>();
-        try {
-            QueryWrapper<CtopOauthToken> oauthTokenQueryWrapper = new QueryWrapper<>();
-            oauthTokenQueryWrapper.eq("media_id", 2);
-            oauthTokenQueryWrapper.eq("account_id", accountId);
-            oauthTokenQueryWrapper.last("limit 1");
-            CtopOauthToken token = tokenMapper.selectOne(oauthTokenQueryWrapper);
-            String endDateStr = DateUtils.getDate("yyyy-MM-dd");
-            String startDate = DateUtils.addMonth(endDateStr, -6);
-            historyReportTaskService.createTask(token.getAccountId(), token.getAccessToken(), startDate, endDateStr, CtopAdConstant.KUAISHOU_LOAD_JOB_TYPE_HISTORY);
-
-        } catch (Exception e) {
-            e.printStackTrace();
-            result.setSuccess(false);
-        }
-        return "success";
-    }
-
-
     @GetMapping(value = "/getHistoryData")
-    public String getHistoryData() {
+    public String getHistoryData(String startDate, String endDate) {
         Result<String> result = new Result<>();
         try {
-            String endDateStr = DateUtils.getDate("yyyy-MM-dd");
-            String startDate = DateUtils.addMonth(endDateStr, -6);
+
             QueryWrapper<CtopOauthToken> tokenQueryWrapper = new QueryWrapper<>();
             tokenQueryWrapper.eq("media_id", 2);
             List<CtopOauthToken> ctopOauthTokens = tokenMapper.selectList(tokenQueryWrapper);
             if (!Check.isNull(ctopOauthTokens)) {
                 for (CtopOauthToken token : ctopOauthTokens) {
-                    historyReportTaskService.createTask(token.getAccountId(), token.getAccessToken(), "2020-09-01", "2020-10-01", CtopAdConstant.KUAISHOU_LOAD_JOB_TYPE_HISTORY);
+                    historyReportTaskService.createTask(token.getAccountId(), token.getAccessToken(), startDate, endDate, CtopAdConstant.KUAISHOU_LOAD_JOB_TYPE_HISTORY);
                 }
 
             }
@@ -793,17 +1044,16 @@ public class TestController {
 
 
     @GetMapping(value = "/getHistoryDataByAccountId")
-    public String getHistoryDataByAccountId(Long accountId) {
+    public String getHistoryDataByAccountId(Long accountId, String startDte, String endDate) {
         Result<String> result = new Result<>();
         try {
-            String endDateStr = DateUtils.getDate("yyyy-MM-dd");
-            String startDate = DateUtils.addMonth(endDateStr, -6);
+
             QueryWrapper<CtopOauthToken> tokenQueryWrapper = new QueryWrapper<>();
             tokenQueryWrapper.eq("media_id", 2);
             tokenQueryWrapper.eq("account_id", accountId);
             CtopOauthToken ctopOauthTokens = tokenMapper.selectOne(tokenQueryWrapper);
             if (!Check.isNull(ctopOauthTokens)) {
-                historyReportTaskService.createTask(ctopOauthTokens.getAccountId(), ctopOauthTokens.getAccessToken(), startDate, endDateStr, CtopAdConstant.KUAISHOU_LOAD_JOB_TYPE_HISTORY);
+                historyReportTaskService.createTask(ctopOauthTokens.getAccountId(), ctopOauthTokens.getAccessToken(), startDte, endDate, CtopAdConstant.KUAISHOU_LOAD_JOB_TYPE_HISTORY);
 
             }
         } catch (Exception e) {
@@ -1208,7 +1458,7 @@ public class TestController {
     private IKuaiShouGroupService kuaiShouGroupService;
     @Autowired
     private IKuaishouStrategyService kuaishouStrategyService;
-
+    static ExecutorService executorServic1e = Executors.newFixedThreadPool(5);
     /**
      * 勿动勿删,煜一人群报表数据拉取接口。
      *
@@ -1235,7 +1485,6 @@ public class TestController {
         } else {
             dayList = DateUtils.getDays(startTime, endTime);
         }
-        ExecutorService executorServic1e = Executors.newFixedThreadPool(8);
         int page = 1;
         int pageSize = 2000;
         dayList.forEach(date -> executorServic1e.submit(() -> {
@@ -1255,41 +1504,41 @@ public class TestController {
     private IAiKuaishouCreateCreativeService createCreativeService;
 
     @GetMapping("testCreateCreative")
-    public Map<String,Object>testCreateCreative(Long accountId,Integer createType){
-        Map<String,Object>result = new HashMap<>();
+    public Map<String, Object> testCreateCreative(Long accountId, Integer createType) {
+        Map<String, Object> result = new HashMap<>();
         AiKuaishouAdvertiserStrategy strategy = strategyService.getByAccountId(accountId);
-        if(strategy == null){
-            ResultMapUtils.setResultMap(result,StatusCode.COMMON_PARAM_ERROR);
+        if (strategy == null) {
+            ResultMapUtils.setResultMap(result, StatusCode.COMMON_PARAM_ERROR);
             return result;
         }
-        createCreativeService.autoCreateCreative(strategy,createType,150L);
-        ResultMapUtils.setResultMap(result,StatusCode.COMMON_SUCCESS);
+        createCreativeService.autoCreateCreative(strategy, createType, 150L);
+        ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
         return result;
     }
 
     @GetMapping("testProgramCreative")
-    public Map<String,Object>testProgramCreative(Long accountId,Integer createType){
-        Map<String,Object>result = new HashMap<>();
+    public Map<String, Object> testProgramCreative(Long accountId, Integer createType) {
+        Map<String, Object> result = new HashMap<>();
         AiKuaishouAdvertiserStrategy strategy = strategyService.getByAccountId(accountId);
-        if(strategy == null){
-            ResultMapUtils.setResultMap(result,StatusCode.COMMON_PARAM_ERROR);
+        if (strategy == null) {
+            ResultMapUtils.setResultMap(result, StatusCode.COMMON_PARAM_ERROR);
             return result;
         }
-        createCreativeService.autoCreateProgramCreative(strategy, createType,150L);
-        ResultMapUtils.setResultMap(result,StatusCode.COMMON_SUCCESS);
+        createCreativeService.autoCreateProgramCreative(strategy, createType, 150L);
+        ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
         return result;
     }
 
     @GetMapping("testCreateCreativeLimit")
-    public Map<String,Object>testCreateCreativeLimit(Long accountId,Integer hour) throws ParseException {
-        Map<String,Object>result = new HashMap<>();
+    public Map<String, Object> testCreateCreativeLimit(Long accountId, Integer hour) throws ParseException {
+        Map<String, Object> result = new HashMap<>();
         AiKuaishouAdvertiserStrategy strategy = strategyService.getByAccountId(accountId);
-        if(strategy == null){
-            ResultMapUtils.setResultMap(result,StatusCode.COMMON_PARAM_ERROR);
+        if (strategy == null) {
+            ResultMapUtils.setResultMap(result, StatusCode.COMMON_PARAM_ERROR);
             return result;
         }
-        createCreativeService.customCreativeSupplement(strategy,hour);
-        ResultMapUtils.setResultMap(result,StatusCode.COMMON_SUCCESS);
+        createCreativeService.customCreativeSupplement(strategy, hour);
+        ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
         return result;
     }
 }

+ 37 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/BytedanceCustomerDdTbtjData.java

@@ -0,0 +1,37 @@
+package org.jeecg.modules.ctop.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 淘宝特价版客户反馈数据
+ * @author jeecg-boot
+ * @date   2021-04-22
+ * @version V1.0
+ */
+@Data
+@TableName("ctop_bytedance_customer_ad_tbtj_data")
+public class BytedanceCustomerDdTbtjData {
+    
+	/**id*/
+	@TableId(type = IdType.AUTO)
+	private Long id;
+	/**adId*/
+	private Long adId;
+	/**stateDate*/
+	private String stateDate;
+	/**loginCnt*/
+	private Integer loginCnt;
+	/**bugerCnt*/
+	private Integer buyerCnt;
+	/**nextDayStay*/
+	private Integer nextDayStay;
+	/**createTime*/
+	private Date createTime;
+	/**updateTime*/
+	private Date updateTime;
+}

+ 0 - 84
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouHourlyGroupReportLoadJob.java

@@ -1,84 +0,0 @@
-package org.jeecg.modules.ctop.job;
-
-import cn.com.ctop.common.module.entity.CtopOauthToken;
-import cn.com.ctop.common.module.service.ICtopOauthTokenService;
-import cn.com.ctop.common.module.utils.CtopAdConstant;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
-import lombok.extern.slf4j.Slf4j;
-import org.jeecg.common.util.DateUtils;
-import org.quartz.Job;
-import org.quartz.JobExecutionContext;
-import org.quartz.JobExecutionException;
-import org.springframework.beans.factory.annotation.Autowired;
-
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.List;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-
-/**
- * 获取 广告组分时数据
- *
- * @author syh
- */
-@Slf4j
-public class KuaishouHourlyGroupReportLoadJob implements Job {
-    @Autowired
-    private ICtopOauthTokenService tokenService;
-    @Autowired
-    private IKuaishouInterfaceService kuaishouInterfaceService;
-
-    static ExecutorService executorService = null;
-    //线程计数器
-    static CountDownLatch countDownLatch = null;
-
-    @Override
-    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
-        Thread thread = new Thread() {
-            @Override
-            public void run() {
-                Date getDate = new Date();
-                SimpleDateFormat simpleDateFormat = new SimpleDateFormat("HH");
-                String hour = simpleDateFormat.format(getDate);
-                if (null != hour && "00".equals(hour)) {
-                    getDate = DateUtils.addDay(getDate, -1);
-                }
-                //1:查询当日数据
-                List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
-                if (null == tokens || tokens.size() <= 0) {
-                    log.info("定时获取快手数据异常:未获取到可用的token");
-                    return;
-                }
-                executorService = Executors.newFixedThreadPool(5);
-                countDownLatch = new CountDownLatch(tokens.size());
-                Date finalGetDate = getDate;
-                tokens.forEach(token -> {
-                    executorService.submit(new Runnable() {
-                        @Override
-                        public void run() {
-                            try {
-                                //3:获取广告组信息数据
-                                kuaishouInterfaceService.getAdvertiserGroupReportHourly(token, finalGetDate, finalGetDate);
-                            } catch (Exception e) {
-                                e.printStackTrace();
-                            } finally {
-                                countDownLatch.countDown();
-                            }
-                        }
-                    });
-                });
-                try {
-                    countDownLatch.await();
-                } catch (InterruptedException e) {
-                    e.printStackTrace();
-                }
-
-                executorService.shutdown();
-            }
-        };
-        thread.start();
-
-    }
-}

+ 19 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/BytedanceCustomerDdTbtjDataMapper.java

@@ -0,0 +1,19 @@
+package org.jeecg.modules.ctop.mapper;
+
+import java.util.List;
+
+import org.apache.ibatis.annotations.Param;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.jeecg.modules.ctop.entity.BytedanceCustomerDdTbtjData;
+import org.jeecg.modules.excelutil.entity.BytedanceCustomTbtjDataEntity;
+
+/**
+ * 淘宝特价版客户反馈数据
+ * @author: jeecg-boot
+ * @date:   2021-04-22
+ * @cersion: V1.0
+ */
+public interface BytedanceCustomerDdTbtjDataMapper extends BaseMapper<BytedanceCustomerDdTbtjData> {
+
+    void replaceDatas(@Param(value = "datas") List<BytedanceCustomTbtjDataEntity> datas);
+}

+ 24 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/xml/BytedanceCustomerDdTbtjDataMapper.xml

@@ -0,0 +1,24 @@
+<?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="org.jeecg.modules.ctop.mapper.BytedanceCustomerDdTbtjDataMapper">
+
+    <insert id="replaceDatas">
+        REPLACE INTO
+        ctop_bytedance_customer_ad_tbtj_data
+        (ad_id,
+        state_date,
+        login_cnt,
+        buyer_cnt,
+        next_day_stay)
+        values
+        <foreach collection="datas" item="data" separator=",">
+            (
+            #{data.adId},
+            #{data.dateString},
+            #{data.loginCnt},
+            #{data.buyerCnt},
+            #{data.nextDayStay}
+            )
+        </foreach>
+    </insert>
+</mapper>

+ 18 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/IBytedanceCustomerDdTbtjDataService.java

@@ -0,0 +1,18 @@
+package org.jeecg.modules.ctop.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.jeecg.modules.ctop.entity.BytedanceCustomerDdTbtjData;
+import org.jeecg.modules.excelutil.entity.BytedanceCustomTbtjDataEntity;
+
+import java.util.List;
+
+/**
+ * @Description: 淘宝特价版客户反馈数据
+ * @Author: jeecg-boot
+ * @Date:   2021-04-22
+ * @Version: V1.0
+ */
+public interface IBytedanceCustomerDdTbtjDataService extends IService<BytedanceCustomerDdTbtjData> {
+
+    void replaceEntityList(List<BytedanceCustomTbtjDataEntity> datas);
+}

+ 28 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/BytedanceCustomerDdTbtjDataServiceImpl.java

@@ -0,0 +1,28 @@
+package org.jeecg.modules.ctop.service.impl;
+
+import org.jeecg.modules.ctop.entity.BytedanceCustomerDdTbtjData;
+import org.jeecg.modules.ctop.mapper.BytedanceCustomerDdTbtjDataMapper;
+import org.jeecg.modules.ctop.service.IBytedanceCustomerDdTbtjDataService;
+import org.jeecg.modules.excelutil.entity.BytedanceCustomTbtjDataEntity;
+import org.springframework.stereotype.Service;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * 淘宝特价版客户反馈数据
+ * @author jeecg-boot
+ * @date   2021-04-22
+ * @version V1.0
+ */
+@Service
+public class BytedanceCustomerDdTbtjDataServiceImpl extends ServiceImpl<BytedanceCustomerDdTbtjDataMapper, BytedanceCustomerDdTbtjData> implements IBytedanceCustomerDdTbtjDataService {
+    @Resource
+    private BytedanceCustomerDdTbtjDataMapper tbtjDataMapper;
+    @Override
+    public void replaceEntityList(List<BytedanceCustomTbtjDataEntity> datas) {
+        tbtjDataMapper.replaceDatas(datas);
+    }
+}

+ 50 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/excelutil/BytedanceCustomTbtjDataExcelListener.java

@@ -0,0 +1,50 @@
+package org.jeecg.modules.excelutil;
+
+import cn.com.ctop.common.module.utils.SpringUtils;
+import com.alibaba.excel.context.AnalysisContext;
+import com.alibaba.excel.event.AnalysisEventListener;
+import org.jeecg.common.util.DateUtils;
+import org.jeecg.modules.ctop.service.impl.BytedanceCustomerDdTbtjDataServiceImpl;
+import org.jeecg.modules.excelutil.entity.BytedanceCustomTbtjDataEntity;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+public class BytedanceCustomTbtjDataExcelListener extends AnalysisEventListener<BytedanceCustomTbtjDataEntity> {
+    //自定义用于暂时存储data。
+    //可以通过实例获取该值
+    private List<BytedanceCustomTbtjDataEntity> datas = new ArrayList<>();
+    private static final int BATCH_COUNT = 200;
+
+    @Override
+    public void invoke(BytedanceCustomTbtjDataEntity object, AnalysisContext context) {
+        //数据存储到list,供批量处理,或后续自己业务逻辑处理。
+        Date date = object.getStateDate();
+        object.setDateString(DateUtils.formatDate(date,"yyyy-MM-dd HH:mm:ss"));
+        datas.add(object);
+        if(null!=datas&&datas.size()>=BATCH_COUNT){
+            saveDate();
+            datas.clear();
+        }
+    }
+
+    private void saveDate() {
+        BytedanceCustomerDdTbtjDataServiceImpl dataService = SpringUtils.getApplicationContext().getBean(BytedanceCustomerDdTbtjDataServiceImpl.class);
+        dataService.replaceEntityList(datas);
+    }
+
+    @Override
+    public void doAfterAllAnalysed(AnalysisContext context) {
+        // 解析结束销毁不用的资源
+         datas.clear();
+    }
+
+    public List<BytedanceCustomTbtjDataEntity> getDatas() {
+        return datas;
+    }
+
+    public void setDatas(List<BytedanceCustomTbtjDataEntity> datas) {
+        this.datas = datas;
+    }
+}

+ 0 - 17
jeecg-boot-module-system/src/main/java/org/jeecg/modules/excelutil/JhsBakendDataExcelListener.java

@@ -38,23 +38,6 @@ public class JhsBakendDataExcelListener extends AnalysisEventListener<JhsBakendD
         dataService.replaceEntityList(datas);
     }
 
-    private void doSomething(Object object) {
-        //入库调用接口
-        JhsBakendDataEntity dataEntity = (JhsBakendDataEntity) object;
-        dataEntity.setCreateTime(new Date());
-        dataEntity.setUpdateTime(new Date());
-        String date = dataEntity.getStateDate();
-        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
-        try {
-            date = DateUtils.formatDate(dateFormat.parse(date));
-        } catch (ParseException e) {
-            e.printStackTrace();
-        }
-        dataEntity.setStateDate(date);
-        JhsBakendDataServiceImpl dataService = SpringUtils.getApplicationContext().getBean(JhsBakendDataServiceImpl.class);
-        dataService.replaceEntity(dataEntity);
-    }
-
     @Override
     public void doAfterAllAnalysed(AnalysisContext context) {
         // datas.clear();//解析结束销毁不用的资源

+ 73 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/excelutil/entity/BytedanceCustomTbtjDataEntity.java

@@ -0,0 +1,73 @@
+package org.jeecg.modules.excelutil.entity;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.alibaba.excel.metadata.BaseRowModel;
+
+import java.util.Date;
+
+public class BytedanceCustomTbtjDataEntity extends BaseRowModel {
+    /**日期*/
+    @ExcelProperty(value = "日期", index = 0)
+    private Date stateDate;
+    /**计划id*/
+    @ExcelProperty(value = "计划id", index = 1)
+    private Long adId;
+    @ExcelProperty(value = "登录人数", index = 2)
+    private Integer loginCnt;
+    /**bugerCnt*/
+    @ExcelProperty(value = "首购人数", index = 3)
+    private Integer buyerCnt;
+    /**nextDayStay*/
+    @ExcelProperty(value = "次留数", index = 4)
+    private Integer nextDayStay;
+    
+    private String dateString;
+
+    public Date getStateDate() {
+        return stateDate;
+    }
+
+    public void setStateDate(Date stateDate) {
+        this.stateDate = stateDate;
+    }
+
+    public Long getAdId() {
+        return adId;
+    }
+
+    public void setAdId(Long adId) {
+        this.adId = adId;
+    }
+
+    public Integer getLoginCnt() {
+        return loginCnt;
+    }
+
+    public void setLoginCnt(Integer loginCnt) {
+        this.loginCnt = loginCnt;
+    }
+
+    public Integer getBuyerCnt() {
+        return buyerCnt;
+    }
+
+    public void setBuyerCnt(Integer buyerCnt) {
+        this.buyerCnt = buyerCnt;
+    }
+
+    public Integer getNextDayStay() {
+        return nextDayStay;
+    }
+
+    public void setNextDayStay(Integer nextDayStay) {
+        this.nextDayStay = nextDayStay;
+    }
+
+    public String getDateString() {
+        return dateString;
+    }
+
+    public void setDateString(String dateString) {
+        this.dateString = dateString;
+    }
+}

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

@@ -290,3 +290,5 @@ ai:
   callback:
     callback-unit-url: http://192.168.1.193:31012/ai_callback_add_group
     callback-creative-url: http://192.168.1.193:31012/ai_callback_add_creative
+xxl-job:
+  requestUrl: http://jiaoyangapi.shyouteng.com.cn

+ 2 - 0
jeecg-boot-module-system/src/main/resources/application-jiaoyang.yml

@@ -261,3 +261,5 @@ ai:
   callback:
     callback-unit-url: http://139.186.27.96:31012/ai_callback_add_group
     callback-creative-url: http://139.186.27.96:31012/ai_callback_add_creative
+xxl-job:
+  requestUrl: http://jiaoyangapi.shyouteng.com.cn

+ 265 - 0
jeecg-boot-module-system/src/main/resources/application-preprod.yml

@@ -0,0 +1,265 @@
+server:
+  port: 8807
+  ip: 39.97.120.42
+  servlet:
+    context-path: /jeecg-boot
+    compression:
+      enabled: true
+      mime-types: application/javascript,application/json,application/xml,text/html,text/xml,text/plain,text/css,image/*
+management:
+  endpoints:
+    web:
+      exposure:
+        include: metrics,httptrace
+spring:
+  servlet:
+    multipart:
+      max-file-size: -1
+      max-request-size: -1
+  mail:
+    host: smtp.exmail.qq.com
+    username: notice@c-top.com.cn
+    password: Hcst@2019
+    properties:
+      mail:
+        smtp:
+          ssl.enable: enable
+          auth: true
+          starttls:
+            enable: true
+            required: true
+    ## quartz定时任务,采用数据库方式
+    #quartz:
+    #job-store-type: jdbc
+  #json 时间戳统一转换
+  jackson:
+    date-format:   yyyy-MM-dd HH:mm:ss
+    time-zone:   GMT+8
+  jpa:
+    open-in-view: false
+  activiti:
+    check-process-definitions: false
+    #启用作业执行器
+    async-executor-activate: false
+    #启用异步执行器
+    job-executor-activate: false
+  aop:
+    proxy-target-class: true
+  #配置freemarker
+  freemarker:
+    # 设置模板后缀名
+    suffix: .ftl
+    # 设置文档类型
+    content-type: text/html
+    # 设置页面编码格式
+    charset: UTF-8
+    # 设置页面缓存
+    cache: false
+    prefer-file-system-access: false
+    # 设置ftl文件路径
+    template-loader-path:
+      - classpath:/templates
+  # 设置静态文件路径,js,css等
+  mvc:
+    static-path-pattern: /**
+  resource:
+    static-locations: classpath:/static/,classpath:/public/
+  autoconfigure:
+    exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
+  datasource:
+    url: jdbc:mysql://172.30.0.4:4000/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
+    username: hcst
+    password: hcst@2020
+    driver-class-name: com.mysql.jdbc.Driver
+    druid:
+      stat-view-servlet:
+        loginUsername: admin
+        loginPassword: hcst20161
+        enabled: true
+      web-stat-filter:
+        enabled: true
+    #      remove-abandoned: false
+    dynamic:
+      druid: # 全局druid参数,绝大部分值和默认保持一致。(现已支持的参数如下,不清楚含义不要乱设置)
+        # 连接池的配置信息
+        # 初始化大小,最小,最大
+        connection-init-sql: set names utf8mb4
+        initial-size: 5
+        min-idle: 5
+        maxActive: 20
+        # 配置获取连接等待超时的时间
+        maxWait: 60000
+        # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
+        timeBetweenEvictionRunsMillis: 60000
+        # 配置一个连接在池中最小生存的时间,单位是毫秒
+        minEvictableIdleTimeMillis: 300000
+        validationQuery: SELECT 1 FROM DUAL
+        testWhileIdle: true
+        testOnBorrow: false
+        testOnReturn: false
+        # 打开PSCache,并且指定每个连接上PSCache的大小
+        poolPreparedStatements: true
+        maxPoolPreparedStatementPerConnectionSize: 20
+        # 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙
+        filters: stat,wall,slf4j
+        # 通过connectProperties属性来打开mergeSql功能;慢SQL记录
+        connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
+      datasource:
+        master:
+          url: jdbc:mysql://172.30.0.4:4000/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
+          username: hcst
+          password: hcst@2020
+          driver-class-name: com.mysql.jdbc.Driver
+          # 多数据源配置
+          #multi-datasource1:
+          #url: jdbc:mysql://localhost:3306/jeecg-boot2?useUnicode=true&characterEncoding=utf8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true
+          #username: root
+          #password: root
+          #driver-class-name: com.mysql.jdbc.Driver
+  #redis 配置
+  redis:
+    database: 0
+    host: 172.30.0.17
+    lettuce:
+      pool:
+        max-active: 8   #最大连接数据库连接数,设 0 为没有限制
+        max-idle: 8     #最大等待连接中的数量,设 0 为没有限制
+        max-wait: -1ms  #最大建立连接等待时间。如果超过此时间将接到异常。设为-1表示无限制。
+        min-idle: 0     #最小等待连接中的数量,设 0 为没有限制
+      shutdown-timeout: 100ms
+    password: foobared
+    port: 6379
+#mybatis plus 设置
+mybatis-plus:
+  mapper-locations: classpath*:org/jeecg/modules/**/xml/*Mapper.xml,classpath*:cn/com/ctop/**/xml/*Mapper.xml
+  global-config:
+    # 关闭MP3.0自带的banner
+    banner: false
+    db-config:
+      #主键类型  0:"数据库ID自增",1:"该类型为未设置主键类型", 2:"用户输入ID",3:"全局唯一ID (数字类型唯一ID)", 4:"全局唯一ID UUID",5:"字符串全局唯一ID (idWorker 的字符串表示)";
+      id-type: 4
+      # 默认数据库表下划线命名
+      table-underline: true
+#  configuration:
+#    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
+#jeecg专用配置
+jeecg:
+  #积木报表设置
+  jmreport:
+    mode: dev
+    #是否需要校验token
+    is_verify_token: false
+    #必须校验方法
+    verify_methods: remove,delete,save,add,update
+  elasticsearch:
+    cluster-nodes:
+    check-enabled: false
+  uploadType:
+  oss:
+    endpoint:
+    accessKey:
+    secretKey:
+    bucketName:
+    staticDomain:
+  sms:
+    accessKeyId:
+    accessKeySecret:
+  minio:
+    minio_url:
+    minio_name:
+    minio_pass:
+    bucketName:
+  ffmpeg:
+    bin: ffmpeg
+  path:
+    #文件上传根目录 设置
+    upload: /data/upload
+    #webapp文件路径
+    webapp: /data/webapp
+    video-upload: /data/upload/video/
+    image-upload: /data/upload/image/
+    kuaishou-agent-image: /data/upload/image/temp.png
+    kuaishou-account-captcha-image: /data/upload/image/captcha.png
+    chrome-driver: /usr/bin/chromedriver
+    csv-upload: /data/upload/csv/
+    bak-database-file: /data/data/bak/
+    report-history: /data/upload/report/history/
+    report-daily: /data/upload/report/daily/
+kuaishou:
+  api-url: https://ad.e.kuaishou.com
+  auth-url: https://ad.e.kuaishou.com
+  appid: 27
+  third-appid: 328
+  oauth-type: agent
+  secret: QovprB1tNhXptgDc
+  third-secret: 1iFTBiMdohkyEQQs
+  callback-url: http://adsp.c-top.com.cn:8080/jeecg-boot/kuaishou
+  third-callback-url: http://callback.shyouteng.com.cn/kuaishou
+  apk-sava-path: /mnt/file/apk
+  image-sava-path: /mnt/file/image
+  video-sava-path: /mnt/file/video
+  model-video-src-path: /mnt/data/src/
+  model-video-fill-path: /mnt/data/fill/
+  model-video-final-path: /mnt/data/final/
+  group-control:
+    path: http://39.106.184.70
+    port: 4723
+logging:
+  level:
+    root: info
+  config: classpath:logback-prod.xml
+chrome:
+  script:
+    clean: sh /data/webapp/cleanProcess.sh
+cas:
+  prefixUrl:
+oss:
+  replace:
+    replace-value: oss-cn-beijing
+    replace-old-value: oss-cn-beijing
+    download: /data/file/video/
+
+zip:
+  local:
+    download-path: /data/unzip/
+bytedance:
+  appId: 1635316529903624
+  secret: 0c51523e90d6166418fc8421a4896808e90e26f4
+  url:
+    auth-prefix: https://ad.oceanengine.com/openapi
+    api-prefix: https://ad.oceanengine.com/open_api
+    callback-url: http://adsp.c-top.com.cn:8080/jeecg-boot/bytedance
+    refresh-token: /oauth2/refresh_token
+    advertiser-info: /2/advertiser/public_info/
+    ad-get: /2/ad/get/
+    ad-create: /2/ad/create/
+    ad-update: /2/ad/update/
+    ad-update-status: /2/ad/update/status/
+    ad-update-bid: /2/ad/update/bid/
+    ad-update-budget: /2/ad/update/budget/
+    ad-update-reject-reason: 2/ad/reject_reason/
+    campaign-get: /2/campaign/get/
+    campaign-create: /2/campaign/create/
+    campaign-update-status: /2/campaign/update/status/
+    campaign-update: /2/campaign/update/
+    dmp-custom-audience-select: /2/dmp/custom_audience/select/
+    file-video-ad: /2/file/video/ad/
+    file-image-ad: /2/file/image/ad/
+    creative-update-status: /2/creative/update/status/
+    creative-material-get: /2/creative/material/read/
+    creative-create-v2: /2/creative/create_v2/
+    creative-get: /2/creative/get/
+    creative-read: /2/creative/read_v2/
+    creative-update: /2/creative/update_v2/
+    creative-reject-reason: /2/creative/reject_reason/
+    advertiser-report-get: /2/report/advertiser/get/
+    campaign-report-get: /2/report/campaign/get/
+    ad-report-get: /2/report/ad/get/
+    ad-creative-get: /2/report/creative/get/
+    advertiser-fund-daily-stat: /2/advertiser/fund/daily_stat/
+ai:
+  callback:
+    callback-unit-url: http://139.186.27.96:31012/ai_callback_add_group
+    callback-creative-url: http://139.186.27.96:31012/ai_callback_add_creative
+xxl-job:
+  requestUrl: http://api.tjyourong.com.cn

+ 2 - 0
jeecg-boot-module-system/src/main/resources/application-prod.yml

@@ -261,3 +261,5 @@ ai:
   callback:
     callback-unit-url: http://139.186.27.96:31012/ai_callback_add_group
     callback-creative-url: http://139.186.27.96:31012/ai_callback_add_creative
+xxl-job:
+  requestUrl: http://api.tjyourong.com.cn

+ 2 - 0
jeecg-boot-module-system/src/main/resources/application-prod2.yml

@@ -253,3 +253,5 @@ ai:
   callback:
     callback-unit-url: http://139.186.27.96:31012/ai_callback_add_group
     callback-creative-url: http://139.186.27.96:31012/ai_callback_add_creative
+xxl-job:
+  requestUrl: http://api.tjyourong.com.cn

+ 2 - 0
jeecg-boot-module-system/src/main/resources/application-test.yml

@@ -250,3 +250,5 @@ ai:
   callback:
     callback-unit-url: http://192.168.1.193:31012/ai_callback_add_group
     callback-creative-url: http://192.168.1.193:31012/ai_callback_add_creative
+xxl-job:
+  requestUrl: http://jiaoyangapi.shyouteng.com.cn

+ 2 - 1
jeecg-boot-module-system/src/main/resources/application-wps.yml

@@ -248,4 +248,5 @@ ai:
   callback:
     callback-unit-url: http://192.168.1.193:31012/ai_callback_add_group
     callback-creative-url: http://192.168.1.193:31012/ai_callback_add_creative
-
+xxl-job:
+  requestUrl: http://jiaoyangapi.shyouteng.com.cn

+ 4 - 11
jeecg-boot-module-system/src/main/resources/jeecg/code-template/one/java/${bussiPackage}/${entityPackage}/controller/${entityName}Controller.javai

@@ -9,8 +9,7 @@ import java.net.URLDecoder;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import org.jeecg.common.api.vo.Result;
-import org.jeecg.modules.query.QueryGenerator;
-import org.jeecg.common.aspect.annotation.AutoLog;
+import cn.com.ctop.common.module.utils.QueryGenerator;
 import org.jeecg.common.util.oConvertUtils;
 import ${bussiPackage}.${entityPackage}.entity.${entityName};
 import ${bussiPackage}.${entityPackage}.service.I${entityName}Service;
@@ -57,7 +56,6 @@ public class ${entityName}Controller {
 	 * @param req
 	 * @return
 	 */
-	@AutoLog(value = "${tableVo.ftlDescription}-分页列表查询")
 	@ApiOperation(value="${tableVo.ftlDescription}-分页列表查询", notes="${tableVo.ftlDescription}-分页列表查询")
 	@GetMapping(value = "/list")
 	public Result<IPage<${entityName}>> queryPageList(${entityName} ${entityName?uncap_first},
@@ -78,7 +76,6 @@ public class ${entityName}Controller {
 	 * @param ${entityName?uncap_first}
 	 * @return
 	 */
-	@AutoLog(value = "${tableVo.ftlDescription}-添加")
 	@ApiOperation(value="${tableVo.ftlDescription}-添加", notes="${tableVo.ftlDescription}-添加")
 	@PostMapping(value = "/add")
 	public Result<${entityName}> add(@RequestBody ${entityName} ${entityName?uncap_first}) {
@@ -98,7 +95,6 @@ public class ${entityName}Controller {
 	 * @param ${entityName?uncap_first}
 	 * @return
 	 */
-	@AutoLog(value = "${tableVo.ftlDescription}-编辑")
 	@ApiOperation(value="${tableVo.ftlDescription}-编辑", notes="${tableVo.ftlDescription}-编辑")
 	@PutMapping(value = "/edit")
 	public Result<${entityName}> edit(@RequestBody ${entityName} ${entityName?uncap_first}) {
@@ -121,10 +117,9 @@ public class ${entityName}Controller {
 	 * @param id
 	 * @return
 	 */
-	@AutoLog(value = "${tableVo.ftlDescription}-通过id删除")
 	@ApiOperation(value="${tableVo.ftlDescription}-通过id删除", notes="${tableVo.ftlDescription}-通过id删除")
 	@DeleteMapping(value = "/delete")
-	public Result<?> delete(@RequestParam(name="id",required=true) String id) {
+	public Result<?> delete(@RequestParam(name="id") String id) {
 		try {
 			${entityName?uncap_first}Service.removeById(id);
 		} catch (Exception e) {
@@ -135,14 +130,13 @@ public class ${entityName}Controller {
 	}
 
 	/**
-	  *  批量删除
+	 *  批量删除
 	 * @param ids
 	 * @return
 	 */
-	@AutoLog(value = "${tableVo.ftlDescription}-批量删除")
 	@ApiOperation(value="${tableVo.ftlDescription}-批量删除", notes="${tableVo.ftlDescription}-批量删除")
 	@DeleteMapping(value = "/deleteBatch")
-	public Result<${entityName}> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
+	public Result<${entityName}> deleteBatch(@RequestParam(name="ids") String ids) {
 		Result<${entityName}> result = new Result<>();
 		if(ids==null || "".equals(ids.trim())) {
 			result.error500("参数不识别!");
@@ -158,7 +152,6 @@ public class ${entityName}Controller {
 	 * @param id
 	 * @return
 	 */
-	@AutoLog(value = "${tableVo.ftlDescription}-通过id查询")
 	@ApiOperation(value="${tableVo.ftlDescription}-通过id查询", notes="${tableVo.ftlDescription}-通过id查询")
 	@GetMapping(value = "/queryById")
 	public Result<${entityName}> queryById(@RequestParam(name="id",required=true) String id) {

+ 3 - 3
jeecg-boot-module-system/src/main/resources/jeecg/code-template/one/java/${bussiPackage}/${entityPackage}/mapper/${entityName}Mapper.javai

@@ -8,9 +8,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 
 /**
  * ${tableVo.ftlDescription}
- * @author: jeecg-boot
- * @date:   ${.now?string["yyyy-MM-dd"]}
- * @cersion: V1.0
+ * @author jeecg-boot
+ * ${.now?string["yyyy-MM-dd"]}
+ * @version V1.0
  */
 public interface ${entityName}Mapper extends BaseMapper<${entityName}> {
 

+ 4 - 4
jeecg-boot-module-system/src/main/resources/jeecg/code-template/one/java/${bussiPackage}/${entityPackage}/service/I${entityName}Service.javai

@@ -4,10 +4,10 @@ import ${bussiPackage}.${entityPackage}.entity.${entityName};
 import com.baomidou.mybatisplus.extension.service.IService;
 
 /**
- * @Description: ${tableVo.ftlDescription}
- * @Author: jeecg-boot
- * @Date:   ${.now?string["yyyy-MM-dd"]}
- * @Version: V1.0
+ * ${tableVo.ftlDescription}
+ * @author jeecg-boot
+ * ${.now?string["yyyy-MM-dd"]}
+ * @version V1.0
  */
 public interface I${entityName}Service extends IService<${entityName}> {
 

+ 1 - 1
jeecg-boot-module-system/src/main/resources/jeecg/code-template/one/java/${bussiPackage}/${entityPackage}/service/impl/${entityName}ServiceImpl.javai

@@ -10,7 +10,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 /**
  * ${tableVo.ftlDescription}
  * @author jeecg-boot
- * @date   ${.now?string["yyyy-MM-dd"]}
+ * ${.now?string["yyyy-MM-dd"]}
  * @version V1.0
  */
 @Service

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

@@ -7,21 +7,4 @@ url=jdbc:mysql://139.186.27.96:4000/jeecg-boot?characterEncoding=UTF-8&useUnicod
 username=data
 password=hcst@2021
 database_name=jeecg-boot
-#oracle
-#diver_name=oracle.jdbc.driver.OracleDriver
-#url=jdbc:oracle:thin:@192.168.1.200:1521:ORCL
-#username=scott
-#password=tiger
-#database_name=ORCL
-#postgre
-#diver_name=org.postgresql.Driver
-#url=jdbc:postgresql://localhost:5432/jeecg
-#username=postgres
-#password=postgres
-#database_name=jeecg
-#SQLServer2005\u4ee5\u4e0a
-#diver_name=org.hibernate.dialect.SQLServerDialect
-#url=jdbc:sqlserver://192.168.1.200:1433;DatabaseName=jeecg
-#username=sa
-#password=SA
-#database_name=jeecg
+

+ 100 - 405
jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java

@@ -2,25 +2,22 @@ package org.jeecg;
 
 import cn.com.ctop.common.module.entity.BindAccountLogin;
 import cn.com.ctop.common.module.entity.CtopOauthToken;
-import cn.com.ctop.common.module.entity.UserAllocation;
 import cn.com.ctop.common.module.service.IBindAccountLoginService;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
-import cn.com.ctop.common.module.service.IUserAllocationService;
 import cn.com.ctop.common.module.utils.CtopAdConstant;
-import cn.com.ctop.kuaishou.modules.batch.service.*;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
 import cn.com.ctop.kuaishou.modules.graphql.service.IKuaishouWebInterfaceService;
-import cn.com.ctop.kuaishou.modules.material.service.IEtlKuaishouVideoInfoService;
 import cn.com.ctop.kuaishou.modules.report.mapper.EtlKuaishouAccountMaterialReportDailyMapper;
-import cn.com.ctop.kuaishou.modules.report.service.*;
-import cn.com.ctop.oa.modules.service.IWechatCheckinDataService;
+import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyImageService;
 import cn.com.ctop.oa.modules.service.IWechatNoListService;
-import cn.com.ctop.oa.modules.service.IWechatUserListService;
 import cn.com.ctop.toutiao.modules.link.service.IETLReportBytedanceVideoService;
 import cn.com.ctop.toutiao.modules.material.service.IByteDanceAdvertiserDataService;
-import cn.com.ctop.toutiao.modules.report.entity.BytedanceAccountReportTaskRecord;
+import cn.com.ctop.toutiao.modules.material.service.IByteDanceCampaignService;
 import cn.com.ctop.toutiao.modules.report.service.*;
+import com.csvreader.CsvReader;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.util.DateUtils;
+import org.jeecg.common.util.RedisUtil;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -29,8 +26,10 @@ import org.springframework.test.context.ActiveProfiles;
 import org.springframework.test.context.junit4.SpringRunner;
 
 import javax.annotation.Resource;
+import java.io.IOException;
+import java.nio.charset.Charset;
 import java.text.ParseException;
-import java.text.SimpleDateFormat;
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
@@ -38,133 +37,67 @@ import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 
-import static org.jeecg.common.util.DateUtils.getAnotherDay;
-
 @RunWith(SpringRunner.class)
 @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
 @ActiveProfiles("wps")
 @Slf4j
 public class SampleTest {
     @Autowired
-    private ICtopOauthTokenService oauthTokenService;
-    @Autowired
-    private IReportService reportService;
-    @Autowired
-    private IByteDanceAdvertiserDataService advertiserDataService;
-    @Autowired
     private ICtopOauthTokenService tokenService;
     @Autowired
-    private IKuaiShouVideoGetService videoGetService;
-    @Autowired
-    private IKuaishouVideoRelateCreativesService kuaishouVideoRelateCreativesService;
-    @Autowired
     private IBindAccountLoginService bindAccountLoginService;
     @Autowired
     private IKuaishouWebInterfaceService kuaishouWebInterfaceService;
-    /*   @Autowired
-       private IByteDanceAdvertiserDataService advertiserDataService;
-
-   */
     @Autowired
-    private IKuaishouReportDailyGroupService reportDailyGroupService;
-    @Autowired
-    private IEtlKuaiShouAccountMaterialOverviewService kuaiShouAccountMaterialOverviewService;
+    private IKuaishouInterfaceService kuaishouInterfaceService;
     @Autowired
-    private IKuaiShouGroupService kuaiShouGroupService;
-
+    private RedisUtil redisUtil;
 
     @Test
-    public void loadBytedanceCreativeData() throws ParseException {
-        Date getDate = DateUtils.addDay(new Date(), -1);
-        Date getDate2 = DateUtils.addDay(new Date(), -2);
-
-        CtopOauthToken token = new CtopOauthToken();
-        token.setAccountId(9901975L);
-        token.setAccessToken("1c7cebebc3174c39fe941d136df65b1d");
-
-        kuaiShouGroupService.getGroupListByPage("90f31a01c2137aa11c8686e86064b630",9845316L,null,1);
-
-//        kuaishouInterfaceService.getAdvertiserReportDaily(token, getDate2, getDate, "adScene");
-
-     /*   JSONObject materialOverview = kuaiShouAccountMaterialOverviewService.getMaterialOverview(5473041L, "2021-03-09");
-        System.err.println(materialOverview);*/
-
-      /*  CtopOauthToken token = new CtopOauthToken();
-        token.setAccountId(9901975L);
-        token.setAccessToken("e609f9d3f56f3d6b4653f32c98a6d119");
-        kuaiShouAccountMaterialOverviewService.cleanAccountMaterialOverview(9901975L, "2021-03-09");
-        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
-        Date parse = simpleDateFormat.parse("2021-03-09");
-        reportDailyGroupService.getAdvertiserGroupReportDaily(token, parse, parse);*/
-
-        //    1662234704806924
-       /* CtopOauthToken token = new CtopOauthToken();
-        token.setAccountId(9549277L);
-        token.setAccessToken("bc5327c8f2bd8a67513e51148c9206c8");
-
-
-
-        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
-        Date parse = simpleDateFormat.parse("2021-02-02");
-        kuaishouInterfaceService.getAdvertiserReportDaily(token, parse, parse);*/
-
-     /*   CtopOauthToken token = new CtopOauthToken();
-        token.setAccountId(9767055L);
-        token.setAccessToken("28e4e6b124e1443d6971ba4c699de6c9");
-
-        kuaishouInterfaceService.getVideoList(token, null, null);
-        kuaishouInterfaceService.getVideoInfo("28e4e6b124e1443d6971ba4c699de6c9", 9767055L, "5208131540349742192");*/
-
-     /*   CtopOauthToken tokenByAccountId = tokenService.getTokenByAccountId(1662234704806924L);
-        advertiserDataService.getMaterialList(tokenByAccountId);*/
-       /* getVideoByPage(token, "", 1);
-        List<KuaiShouVideoGet> KuaiShouVideoGets = videoGetService.selectPhotoIdsByAccountId(9743746L);
-        if (!Check.isNull(KuaiShouVideoGets)) {
-            JSONArray dateList = new JSONArray();
-            JSONArray photoIds = new JSONArray();
-            Map<String, Object> statdateMap = new HashMap<>();
-            int count = 0;
-            for (KuaiShouVideoGet video : KuaiShouVideoGets) {
-                count++;
-                if (count < 10) {
-                    photoIds.add(video.getPhotoId());
-                    statdateMap.put(video.getPhotoId(), video.getStatDate());
-                } else {
-                    photoIds.add(video.getPhotoId());
-                    statdateMap.put(video.getPhotoId(), video.getStatDate());
-                    dateList.add(photoIds);
-                    photoIds = new JSONArray();
-                    count = 0;
-                }
+    public void loadKuaishouCookie() throws ParseException {
+
+        redisUtil.set("11sdfhgjksdhfjksdhfjksdhfkjsjkfhkjsddhfjksdhfkjhsjkfhjkshfjksdhfjksdhfjkshdjkfhsjkdfhkjsd1","hahahaha",5);
+        Object o = redisUtil.get("11sdfhgjksdhfjksdhfjksdhfkjsjkfhkjsddhfjksdhfkjhsjkfhjkshfjksdhfjksdhfjkshdjkfhsjkdfhkjsd1");
+        System.err.println(o);
+
+
+        /*try {
+            // 用来保存数据
+            ArrayList<String[]> csvFileList = new ArrayList<String[]>();
+            // 定义一个CSV路径
+            String csvFilePath = "D:\\test\\123.csv";
+            // 创建CSV读对象 例如:CsvReader(文件路径,分隔符,编码格式);
+            CsvReader reader = new CsvReader(csvFilePath, ',', Charset.forName("UTF-8"));
+            // 跳过表头 如果需要表头的话,这句可以忽略
+            reader.readHeaders();
+            // 逐行读入除表头的数据
+            while (reader.readRecord()) {
+                System.out.println(reader.getRawRecord());
+                csvFileList.add(reader.getValues());
             }
-            dateList.add(photoIds);
-            kuaishouVideoRelateCreativesService.videoRelateCreatives(9743746L, dateList, statdateMap);
-        }*/
-    }
+            reader.close();
 
-    @Test
-    public void loadKuaishouCookie() {
-        List<BindAccountLogin> list = bindAccountLoginService.getListByParams(CtopAdConstant.PLATFORM_TYPE_KUAISHOU_PY, 1);
-        if (list != null && !list.isEmpty()) {
-            int i = 0;
-            for (BindAccountLogin login : list) {
-                if (null == login.getCookie() || "".equals(login.getCookie().trim())) {
-                    kuaishouWebInterfaceService.getkuaishouWebLoginCookie(login);
-                    i++;
-                }
+            // 遍历读取的CSV文件
+            for (int row = 0; row < csvFileList.size(); row++) {
+                // 取得第row行第0列的数据
+                String cell = csvFileList.get(row)[0];
+                System.out.println("------------>" + cell);
             }
-        }
-    }
+        } catch (IOException e) {
+            e.printStackTrace();
+        }*/
 
-    @Test
-    public void loadKuaishouCamgaignData(){
-        Date getDate = DateUtils.parseDate("2021-03-24","yyyy-MM-dd");
-        List<UserAllocation> list = allocationService.getByParams(50L,null,0);
-        list.forEach(userAllocation -> {
-            CtopOauthToken token = tokenService.getOauthTokenByAccountId(userAllocation.getAccountId().toString());
-            kuaishouInterfaceService.getAdvertiserCampaignReportDaily(token, getDate, getDate);
-        });
+
+
+
+
+       /* CtopOauthToken tokenByAccountId = tokenService.getTokenByAccountId(9792526L);
+        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
+        Date parse = dateFormat.parse("2021-04-02");
+        kuaishouInterfaceService.getAdvertiserReportDaily(tokenByAccountId, parse, parse, null);*/
     }
+
+
     static ExecutorService executorService = null;
     static CountDownLatch countDownLatch = null;
 
@@ -195,208 +128,30 @@ public class SampleTest {
     }
 
     @Autowired
-    private IUserAllocationService allocationService;
-
-    @Test
-    public void testLoadBytedanceData() {
-        List<UserAllocation> allocations = allocationService.getByParams(633L, null, 0);
-        if (null != allocations && !allocations.isEmpty()) {
-            for (UserAllocation allocation : allocations) {
-                CtopOauthToken token = tokenService.getTokenByAccountId(allocation.getAccountId());
-                String startDate = "2020-11-10";
-                String endDate = "2020-11-10";
-                reportService.getAdvertiserReport(token, DateUtils.parseDate(startDate, "yyyy-MM-dd"), DateUtils.parseDate(endDate, "yyyy-MM-dd"), CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY);
-            }
-        }
-        System.out.println("任务结束");
-    }
-
-    @Test
-    public void loadKuaishouPlanData() {
-        Date getDate = DateUtils.addDay(new Date(), -1);
-        //1:查询当日数据
-        List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
-        tokens.forEach(token -> kuaishouInterfaceService.getAdvertiserCampaignReportDaily(token, getDate, getDate));
-    }
-
-    @Autowired
-    private IBytedanceFundDailyService bytedanceFundDailyService;
-
-    @Test
-    public void loadFoudData() {
-        List<CtopOauthToken> tokens = tokenService.selectToutiaoToken();
-        for (CtopOauthToken token : tokens) {
-            System.out.println(token.getAccountId() + "############################");
-            for (int i = 20; i < 130; i++) {
-                Date date = DateUtils.addDay(new Date(), -i);
-                bytedanceFundDailyService.loadFundDataByPage(token, DateUtils.formatDate(date), DateUtils.formatDate(date), 1);
-                System.out.println(i + "############################");
-            }
-        }
-    }
-
-    @Autowired
-    private IKuaiShouHistoryReportTaskService reportTaskService;
-
-    /**
-     * 测试获取快手图片消耗数据任务
-     */
-    @Test
-    public void loadKuaishouImageTask() {
-        List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
-        for (int i = 1; i < 130; i++) {
-            Date getDate = DateUtils.addDay(new Date(), -i);
-            String getDateStr = DateUtils.formatDate(getDate);
-            tokens.forEach(token -> reportTaskService.createTask(token.getAccountId(), token.getAccessToken(), getDateStr, getDateStr, CtopAdConstant.KUAISHOU_LOAD_JOB_TYPE_DAILY));
-        }
-    }
-
-    @Autowired
-    private IKuaiShouDailyReportTaskService dailyReportTaskService;
-
-    /**
-     * 测试获取快手图片消耗数据入库
-     */
-    @Test
-    public void loadKuaishouImageTaskFile() {
-        String nowDate = DateUtils.getDate("yyyy-MM-dd");
-        List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
-        for (int i = 1; i < 15; i++) {
-            String statDate = getAnotherDay("yyyy-MM-dd", nowDate, -i);
-            tokens.forEach(token -> dailyReportTaskService.getTaskList(token.getAccountId(), token.getAccessToken(), statDate));
-        }
-        //  查询快手token
-    }
-
-    @Test
-    public void testLoadBytedanceImageData() {
-        List<CtopOauthToken> tokens = tokenService.selectToutiaoToken();
-        countDownLatch = new CountDownLatch(tokens.size());
-        executorService = Executors.newFixedThreadPool(8);
-        tokens.forEach(token -> executorService.submit(() -> {
-            try {
-                advertiserDataService.getMaterialList(token);
-            } catch (Exception e) {
-            } finally {
-                countDownLatch.countDown();
-            }
-        }));
-        try {
-            countDownLatch.await();
-        } catch (InterruptedException e) {
-            e.printStackTrace();
-        }
-        System.out.println("素材数据获取完成");
-
-    }
-
-    @Autowired
-    private IKuaishouReportDailyAgentService kuaishouReportDailyAgentService;
-
-    @Test
-    public void testData() {
-        Date date = new Date();
-        List<CtopOauthToken> tokens = tokenService.selectToutiaoToken();
-        executorService = Executors.newFixedThreadPool(10);
-        countDownLatch = new CountDownLatch(tokens.size());
-        tokens.forEach(token -> executorService.submit(() -> {
-            try {
-                reportService.getAdvertiserPlanRuleData(token, date, date, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
-            } catch (Exception e) {
-
-            } finally {
-                countDownLatch.countDown();
-            }
-        }));
-        try {
-            countDownLatch.await();
-        } catch (InterruptedException e) {
-            e.printStackTrace();
-        }
-    }
-
-    @Test
-    public void loadKuaishouAgentData() {
-        kuaishouReportDailyAgentService.loginAgent();
-        try {
-            for (int i = 1; i < 30; i++) {
-                kuaishouReportDailyAgentService.getAccount(i);
-            }
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-    }
-
-    @Test
-    public void loadKuaishouData() {
-        Date getDate = DateUtils.addDay(new Date(), -1);
-        //1:查询当日数据
-        List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
-        for (CtopOauthToken token : tokens) {
-            kuaishouInterfaceService.getAdvertiserCampaignReportDaily(token, getDate, getDate);
-        }
-    }
+    private IBytedanceReportService bytedanceReportService;
 
     @Autowired
-    private IBytedanceReportService bytedanceReportService;
+    private IByteDanceAdvertiserDataService advertiserDataService;
 
     @Test
     public void loadBytedanceVideoReportData() {
-        Date getDate = DateUtils.addDay(new Date(), -1);
-        String date = DateUtils.formatDate(getDate);
-        List<CtopOauthToken> tokens = tokenService.selectToutiaoToken();
-        for (CtopOauthToken token : tokens) {
-            bytedanceReportService.bytedanceVideoMaterialReport(token, date, date);
-        }
-    }
-
-    @Test
-    public void loadKuaishouHourlyReportData() {
-        Date getDate = new Date();
-        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("HH");
-        String hour = simpleDateFormat.format(getDate);
-        if ("00".equals(hour)) {
-            getDate = DateUtils.addDay(getDate, -1);
-        }
-        //1:查询当日数据
-        List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
-        Date finalGetDate = getDate;
-        tokens.forEach(token -> kuaishouInterfaceService.getAdvertiserReportHourly(token, finalGetDate, finalGetDate));
+        CtopOauthToken token = tokenService.getTokenByAccountId(1696831659659278L);
+        advertiserDataService.getMaterialList(token);
     }
 
     @Autowired
-    private IKuaishouInterfaceService kuaishouInterfaceService;
-
-    @Test
-    public void loadKuaishouGroupData() throws ParseException {
-        Date endDate = new Date();
-        String anotherDay = DateUtils.getAnotherDay("yyyy-MM-dd", DateUtils.formatDate(endDate), -1);
-        SimpleDateFormat sim = new SimpleDateFormat("yyyy-MM-dd");
-        Date startDate = sim.parse(anotherDay);
-        CtopOauthToken token = tokenService.getTokenByAccountId(7087890L);
-        kuaishouInterfaceService.getGroupList(token, startDate, endDate);
-    }
-
+    private IWechatNoListService wechatNoListService;
+    @Autowired
+    private IETLReportBytedanceVideoService bytedanceVideoService;
 
     @Test
-    public void loadAccountData() {
-//        List<UserAllocation> allocations = allocationService.getByParams(776L,null,0);
-//        for (UserAllocation allocation:allocations) {
-        CtopOauthToken token = tokenService.getTokenByAccountId(93238965516L);
-        for (int i = 92; i < 100; i++) {
-            Date getDate = DateUtils.addDay(new Date(), -i);
-            reportService.getAdvertiserReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
+    public void etlBytedanceVideoInfo() {
+        String startDate = "2021-02-01";
+        for (int i = 0; i < 100; i++) {
+            bytedanceVideoService.cleanData(DateUtils.addDay(startDate, i));
         }
-//        }
     }
 
-    @Autowired
-    private IWechatCheckinDataService wechatCheckinDataService;
-    @Autowired
-    private IWechatUserListService wechatUserInfoService;
-    @Autowired
-    private IWechatNoListService wechatNoListService;
-
     @Test
     public void getData() {
         //汇创 人员
@@ -411,20 +166,12 @@ public class SampleTest {
         wechatNoListService.getNoDateByNo("2021-03-01 00:00:00", "2021-03-31 23:59:59", "1");
     }
 
-    @Autowired
-    private IKuaiShouCommentService kuaiShouCommentService;
-
-    @Test
-    public void kuaishouDeleteComment() {
-        kuaiShouCommentService.shieldComment(8018853L);
-    }
 
     @Autowired
     private IByteDanceVideoReportDailyService videoReportDailyService;
 
     @Test
-    synchronized public void formatVideoReportData() {
-
+    public void formatVideoReportData() {
         for (int i = 1; i < 45; i++) {
             Date getDate = DateUtils.addDay(new Date(), -i);
             String date = DateUtils.formatDate(getDate);
@@ -442,120 +189,68 @@ public class SampleTest {
     IKuaishouReportDailyImageService kuaishouReportDailyImageService;
     @Autowired
     IRuleByteDanceAccountService ruleByteDanceAccountService;
-    @Autowired
-    private IKuaishouVideoEtlInfoService kuaishouVideoEtlInfoService;
-    @Autowired
-    private IBytedanceAccountReportTaskRecordService reportTaskRecordService;
-
-
-    @Test
-    public void execute() {
-        List<UserAllocation> allocations = allocationService.listByMediaId("3", 0);
-        for (UserAllocation allocation : allocations) {
-            BytedanceAccountReportTaskRecord reportTaskRecord1 = new BytedanceAccountReportTaskRecord(allocation.getAccountId(), "2020-10-01", "2020-10-31");
-            reportTaskRecordService.save(reportTaskRecord1);
-            BytedanceAccountReportTaskRecord reportTaskRecord2 = new BytedanceAccountReportTaskRecord(allocation.getAccountId(), "2020-11-01", "2020-11-30");
-            reportTaskRecordService.save(reportTaskRecord2);
-            BytedanceAccountReportTaskRecord reportTaskRecord3 = new BytedanceAccountReportTaskRecord(allocation.getAccountId(), "2020-12-01", "2020-12-31");
-            reportTaskRecordService.save(reportTaskRecord3);
-        }
-    }
 
     @Test
     public void loadBDAccoutData() {
-        Date startDate = DateUtils.addDay(new Date(),-2000);
-        for(int i=0;i<=2000;i++){
-            Date getDate = DateUtils.addDay(startDate,i);
-            bytedanceVideoEtlInfoService.etlBytedanceVideoInfo(getDate);
-        }
-    }
-
-
-
-
-
-    @Test
-    public void etlKuaishouData() {
-        String dateString = "2021-01-05";
-        Date startDate = DateUtils.parseDate(dateString, "yyyy-MM-dd");
-        for (int i = 0; i <= 10; i++) {
+        Date startDate = DateUtils.addDay(new Date(), -2000);
+        for (int i = 0; i <= 2000; i++) {
             Date getDate = DateUtils.addDay(startDate, i);
-            kuaishouVideoEtlInfoService.etlKuaishouVideoInfo(getDate);
             bytedanceVideoEtlInfoService.etlBytedanceVideoInfo(getDate);
         }
     }
 
-    @Test
-    public void loadBytedanceVideo() {
-        CtopOauthToken token = tokenService.getTokenByAccountId(1673731601820686L);
-        for (int i = 15; i < 60; i++) {
-            reportService.getAdvertiserReport(token, DateUtils.addDay(new Date(), -i), DateUtils.addDay(new Date(), -i), CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
-        }
-    }
+    @Resource
+    private EtlKuaishouAccountMaterialReportDailyMapper etlKuaishouAccountMaterialReportDailyMapper;
 
     @Test
-    public void loadKuaishouVideo() {
-        Date date = new Date();
-        CtopOauthToken token = tokenService.getTokenByAccountId(9556344L);
-//        kuaishouInterfaceService.getAdvertiserCreativeReportDaily(token, new Date(), new Date(), null, null);
-        kuaishouInterfaceService.getVideoList(token, DateUtils.formatDate(DateUtils.addDay(date, -5)), DateUtils.formatDate(date));
-        // 获取图片信息数据
-//        kuaishouInterfaceService.getImageList(token, DateUtils.getNowDate("yyyy-MM-dd"));
+    public void etlKuaishouVideoInfo() {
+        etlKuaishouAccountMaterialReportDailyMapper.etlKuaishouAccountMaterialReportDailyData(DateUtils.formatDate());
     }
 
-
-
-    @Test
-    public void testLoadBytedanceDataV2() {
-        String accountIds = "1675440464386062";
-        String[] accountArray = accountIds.split(",");
-        for (int i = 0; i < accountArray.length; i++) {
-            CtopOauthToken token = tokenService.getTokenByAccountId(Long.parseLong(accountArray[i]));
-            reportService.getAdvertiserReport(token, DateUtils.parseDate("2021-01-14", "yyyy-MM-dd"), DateUtils.parseDate("2021-01-14", "yyyy-MM-dd"), CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
-        }
-    }
+    @Autowired
+    private IByteDanceCampaignService campaignService;
 
     @Test
-    public void loadKuaiShouImage() {
-        List<CtopOauthToken> tokens = oauthTokenService.selectKuaiShouToken();
-        executorService = Executors.newFixedThreadPool(22);
-        countDownLatch = new CountDownLatch(tokens.size());
-        tokens.forEach(token -> executorService.submit(() -> {
-            try {
-                kuaishouReportDailyImageService.getMaterialImageReport(token.getAccountId(), token.getAccessToken(), "2021-01-17", "2021-01-31", 1);
-            } catch (Exception e) {
-
-            } finally {
-                countDownLatch.countDown();
-            }
-        }));
-        try {
-            countDownLatch.await();
-        } catch (InterruptedException e) {
-            e.printStackTrace();
+    public void testLoadBytedanceCampaign() {
+        List<CtopOauthToken> tokens = tokenService.selectToutiaoToken();
+        for (CtopOauthToken token : tokens) {
+            campaignService.getAdvertiserCampaign(token, null, null);
         }
     }
 
     @Autowired
-    private IEtlKuaishouAccountMaterialReportDailyService dailyService;
+    private IEtlBytedanceReportVideoDailyService etlBytedanceReportVideoDailyService;
 
     @Test
-    public void etlKuaishouInfo() {
-        Date startDate = DateUtils.parseDate("2020-05-03", "yyyy-MM-dd");
-        for (int i = 0; i < 365; i++) {
-            dailyService.etlKuaishouAccountMaterialReportDailyData(DateUtils.formatDate(DateUtils.addDay(startDate, i)));
-        }
+    public void etlBytedanceVideoReportInfo()throws Exception{
+        etlBytedanceReportVideoDailyService.etlBytedanceVideo();
     }
 
     @Autowired
-    private IEtlKuaishouVideoInfoService videoEtlInfoService;
-    @Resource
-    private EtlKuaishouAccountMaterialReportDailyMapper etlKuaishouAccountMaterialReportDailyMapper;
+    private IReportService reportService;
+
     @Test
-    public void etlKuaishouVideoInfo() {
-        etlKuaishouAccountMaterialReportDailyMapper.etlKuaishouAccountMaterialReportDailyData(DateUtils.formatDate());
+    public void loadBytedanceAccountReport(){
+        /**
+         * 1692555408132110
+         * 1692555631713287
+         * 1696734332089352
+         * 1696734333251598
+         */
+        CtopOauthToken token1 = tokenService.getTokenByAccountId(1692555408132110L);
+        reportService.getAdvertiserReport(token1, DateUtils.parseDate("2021-05-01","yyyy-MM-dd"), DateUtils.parseDate("2021-05-12","yyyy-MM-dd"), CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
+        CtopOauthToken token2 = tokenService.getTokenByAccountId(1692555631713287L);
+        reportService.getAdvertiserReport(token2, DateUtils.parseDate("2021-05-01","yyyy-MM-dd"), DateUtils.parseDate("2021-05-12","yyyy-MM-dd"), CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
+        CtopOauthToken token3 = tokenService.getTokenByAccountId(1696734332089352L);
+        reportService.getAdvertiserReport(token3, DateUtils.parseDate("2021-05-01","yyyy-MM-dd"), DateUtils.parseDate("2021-05-12","yyyy-MM-dd"), CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
+        CtopOauthToken token4 = tokenService.getTokenByAccountId(1696734333251598L);
+        reportService.getAdvertiserReport(token4, DateUtils.parseDate("2021-05-01","yyyy-MM-dd"), DateUtils.parseDate("2021-05-12","yyyy-MM-dd"), CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
+
+        CtopOauthToken token5 = tokenService.getTokenByAccountId(10129666L);
+        kuaishouInterfaceService.getAdvertiserReportDaily(token5, DateUtils.parseDate("2021-05-07","yyyy-MM-dd"), DateUtils.parseDate("2021-05-11","yyyy-MM-dd"), null);
+        CtopOauthToken token6 = tokenService.getTokenByAccountId(10097961L);
+        kuaishouInterfaceService.getAdvertiserReportDaily(token6, DateUtils.parseDate("2021-05-07","yyyy-MM-dd"), DateUtils.parseDate("2021-05-11","yyyy-MM-dd"), null);
+        CtopOauthToken token7 = tokenService.getTokenByAccountId(10098039L);
+        kuaishouInterfaceService.getAdvertiserReportDaily(token7, DateUtils.parseDate("2021-05-07","yyyy-MM-dd"), DateUtils.parseDate("2021-05-11","yyyy-MM-dd"), null);
     }
-
-
-
 }

+ 20 - 13
module-common/src/main/java/cn/com/ctop/common/module/entity/MaterialInfo.java

@@ -1,5 +1,6 @@
 package cn.com.ctop.common.module.entity;
 
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableField;
@@ -126,15 +127,21 @@ public class MaterialInfo {
     @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
     private Date updateTime;
 
-    private Integer toutiaoEffiType; //判断是否为头条有效素材0否_1是
+    //判断是否为头条有效素材0否_1是
+    private Integer toutiaoEffiType;
+    // 素造供应商
+    private String supplierCode;
 
-    private Integer kuaishouEffiType; //判断是否为快手有效素材0否_1是
+    //判断是否为快手有效素材0否_1是
+    private Integer kuaishouEffiType;
 
+    //判断是否已经同步到快手平台0否_1是
     @TableField(exist = false)
-    private Integer kuaishouVideoIsUp;  //判断是否已经同步到快手平台0否_1是
+    private Integer kuaishouVideoIsUp;
 
+    //判断是否已经同步到头条平台0否_1是
     @TableField(exist = false)
-    private Integer toutiaoVideoIsUp;  //判断是否已经同步到头条平台0否_1是
+    private Integer toutiaoVideoIsUp;
 
     @TableField(exist = false)
     private JSONObject byteDance;
@@ -142,11 +149,13 @@ public class MaterialInfo {
     @TableField(exist = false)
     private JSONObject kuaiShou;
 
+    //拍摄时候担任的角色
     @TableField(exist = false)
-    private String videoRoleCode;  //拍摄时候担任的角色
+    private String videoRoleCode;
 
+    //原本的角色
     @TableField(exist = false)
-    private String originRoleName;  //原本的角色
+    private String originRoleName;
 
     @TableField(exist = false)
     private BigDecimal cost;
@@ -157,9 +166,9 @@ public class MaterialInfo {
     @TableField(exist = false)
     private String realname;
 
+    // 是否有未审核封面
     @TableField(exist = false)
-    private Boolean whetherUnaudited;  // 是否有未审核封面
-
+    private Boolean whetherUnaudited;
 
     @TableField(exist = false)
     private String mediaId;  // 是否有未审核封面
@@ -167,15 +176,13 @@ public class MaterialInfo {
     @TableField(exist = false)
     private String projectName;  // 是否有未审核封面
 
-
-    private String supplierCode; // 素造供应商
-
-
     @TableField(exist = false)
     private String startDate;  // 是否有未审核封面
 
     @TableField(exist = false)
     private String endDate;  // 是否有未审核封面
 
-
+    //视频关联广告语信息--头条
+    @TableField(exist = false)
+    private JSONArray slogans;
 }

+ 3 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/MaterialInfoMapper.java

@@ -1,6 +1,7 @@
 package cn.com.ctop.common.module.mapper;
 
 import cn.com.ctop.common.module.entity.MaterialInfo;
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Param;
@@ -36,4 +37,6 @@ public interface MaterialInfoMapper extends BaseMapper<MaterialInfo> {
     List<MaterialInfo> getListByDate(@Param("startDate") String startDate,@Param("endDate") String endDate);
 
     List<MaterialInfo> getListByParams(@Param("tagCode")String tagCode,@Param("type")String type, @Param("status")Integer status, @Param("projectIds")List<Long> projectIds, @Param("materialName")String materialName, @Param("code")String code, @Param("startDate")String startDate, @Param("endDate")String endDate, @Param("userId")String userId);
+
+    JSONArray getIdListByProject(Long projectId);
 }

+ 44 - 36
module-common/src/main/java/cn/com/ctop/common/module/mapper/SysDepartMapper.java

@@ -1,9 +1,10 @@
 package cn.com.ctop.common.module.mapper;
 
 import cn.com.ctop.common.module.entity.SysDepart;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
-import org.springframework.data.repository.query.Param;
 
 import java.util.List;
 
@@ -13,42 +14,49 @@ import java.util.List;
  * <p>
  *
  * @Author: Steve
- * @Since:   2019-01-22
+ * @Since: 2019-01-22
  */
 public interface SysDepartMapper extends BaseMapper<SysDepart> {
 
-	/**
-	 * 根据用户ID查询部门集合
-	 */
-	public List<SysDepart> queryUserDeparts(@Param("userId") String userId);
-
-	/**
-	 * 根据用户名查询部门
-	 *
-	 * @param username
-	 * @return
-	 */
-	public List<SysDepart> queryDepartsByUsername(@Param("username") String username);
-
-	@Select("select id from sys_depart where org_code=#{orgCode}")
-	public String queryDepartIdByOrgCode(@Param("orgCode") String orgCode);
-
-	@Select("select id,parent_id from sys_depart where id=#{departId}")
-	public SysDepart getParentDepartId(@Param("departId") String departId);
-
-	/**
-	 *  根据部门Id查询,当前和下级所有部门IDS
-	 * @param departId
-	 * @return
-	 */
-	List<String> getSubDepIdsByDepId(@Param("departId") String departId);
-
-	/**
-	 * 根据部门编码获取部门下所有IDS
-	 * @param orgCodes
-	 * @return
-	 */
-	List<String> getSubDepIdsByOrgCodes(@org.apache.ibatis.annotations.Param("orgCodes") String[] orgCodes);
-
-	SysDepart queryUserDepartsByDepartId(@Param("departId") String departId);
+    /**
+     * 根据用户ID查询部门集合
+     */
+    public List<SysDepart> queryUserDeparts(@Param("userId") String userId);
+
+    /**
+     * 根据用户名查询部门
+     *
+     * @param username
+     * @return
+     */
+    public List<SysDepart> queryDepartsByUsername(@Param("username") String username);
+
+    @Select("select id from sys_depart where org_code=#{orgCode}")
+    public String queryDepartIdByOrgCode(@Param("orgCode") String orgCode);
+
+    @Select("select id,parent_id from sys_depart where id=#{departId}")
+    public SysDepart getParentDepartId(@Param("departId") String departId);
+
+    /**
+     * 根据部门Id查询,当前和下级所有部门IDS
+     *
+     * @param departId
+     * @return
+     */
+    List<String> getSubDepIdsByDepId(@Param("departId") String departId);
+
+    /**
+     * 根据部门编码获取部门下所有IDS
+     *
+     * @param orgCodes
+     * @return
+     */
+    List<String> getSubDepIdsByOrgCodes(@org.apache.ibatis.annotations.Param("orgCodes") String[] orgCodes);
+
+    SysDepart queryUserDepartsByDepartId(@Param("departId") String departId);
+
+    List<JSONObject> getDepartmentIds(@Param("userId") String userId);
+
+    List<JSONObject> checkLowestLevelDepartment(@Param("departIds") List<JSONObject> departIds);
+
 }

+ 1 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/SysRoleMapper.java

@@ -34,4 +34,5 @@ public interface SysRoleMapper extends BaseMapper<SysRole> {
     @Delete("delete from sys_role_permission where role_id = #{roleId}")
     void deleteRolePermissionRelation(@Param("roleId") String roleId);
 
+    SysRole queryRoleByUserId(@Param("userId") String userId);
 }

+ 3 - 1
module-common/src/main/java/cn/com/ctop/common/module/mapper/SysUserDepartMapper.java

@@ -2,7 +2,7 @@ package cn.com.ctop.common.module.mapper;
 
 import cn.com.ctop.common.module.entity.SysUserDepart;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import io.lettuce.core.dynamic.annotation.Param;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
@@ -15,4 +15,6 @@ public interface SysUserDepartMapper extends BaseMapper<SysUserDepart>{
     List<SysUserDepart> getUserDepartByUid(@Param("userId") String userId);
 
 	SysUserDepart getUserDepartByUserId(@Param("userId") String userId);
+
+    List<String> getUserIds(@Param("ids") List<String> ids);
 }

+ 6 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/MaterialInfoMapper.xml

@@ -134,6 +134,12 @@
         and DATE_FORMAT(create_time,'%Y-%m-%d') &gt;= #{startDate}
         and DATE_FORMAT(create_time,'%Y-%m-%d') &lt;= #{endDate}
     </select>
+    <select id="getIdListByProject" resultType="java.lang.String">
+        select id  from  ctop_material_info
+        where project_id = #{projectId}
+        and status != 2
+        and DATE_FORMAT(create_time,'%Y-%m-%d') &gt;= '2021-04-28'
 
+    </select>
 
 </mapper>

+ 33 - 13
module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/SysDepartMapper.xml

@@ -2,9 +2,11 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="cn.com.ctop.common.module.mapper.SysDepartMapper">
 
-	<select id="queryUserDeparts" parameterType="String" resultType="cn.com.ctop.common.module.entity.SysDepart">
-	   select * from sys_depart where id IN ( select dep_id from sys_user_depart where user_id = #{userId} )
-	</select>
+    <select id="queryUserDeparts" parameterType="String" resultType="cn.com.ctop.common.module.entity.SysDepart">
+        select *
+        from sys_depart
+        where id IN (select dep_id from sys_user_depart where user_id = #{userId})
+    </select>
 
     <!-- 根据username查询所拥有的部门 -->
     <select id="queryDepartsByUsername" parameterType="String" resultType="cn.com.ctop.common.module.entity.SysDepart">
@@ -23,22 +25,40 @@
 
     <!-- 根据部门Id查询,当前和下级所有部门IDS -->
     <select id="getSubDepIdsByDepId" resultType="java.lang.String">
-		select id from sys_depart where del_flag = '0' and org_code like concat((select org_code from sys_depart where id=#{departId}),'%')
-	</select>
+        select id
+        from sys_depart
+        where del_flag = '0'
+          and org_code like concat((select org_code from sys_depart where id = #{departId}), '%')
+    </select>
 
     <!--根据部门编码获取我的部门下所有部门ids -->
     <select id="getSubDepIdsByOrgCodes" resultType="java.lang.String">
-		select id from sys_depart where del_flag = '0' and
-        <foreach collection="orgCodes" item="item" index="index"  open="(" separator="or" close=")">
+        select id from sys_depart where del_flag = '0' and
+        <foreach collection="orgCodes" item="item" index="index" open="(" separator="or" close=")">
             org_code LIKE CONCAT(#{item},'%')
         </foreach>
-	</select>
+    </select>
+
+    <select id="queryUserDepartsByDepartId" parameterType="String"
+            resultType="cn.com.ctop.common.module.entity.SysDepart">
+        select *
+        from sys_depart
+        where id = #{departId} limit 1
+    </select>
 
-    <select id="queryUserDepartsByDepartId" parameterType="String" resultType="cn.com.ctop.common.module.entity.SysDepart">
-		select * from sys_depart
-			where id = #{departId}
-			limit 1
-	</select>
+    <select id="getDepartmentIds" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT dep_id as 'id'
+        FROM sys_user_depart
+        WHERE user_id = #{userId}
+    </select>
+
+    <select id="checkLowestLevelDepartment" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT id,parent_id FROM sys_depart WHERE parent_id IN
+        <foreach item="item" index="index" collection="departIds"
+                 open="(" separator="," close=")">
+            #{item.id}
+        </foreach>
+    </select>
 
 
 </mapper>

+ 18 - 14
module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/SysRoleMapper.xml

@@ -4,22 +4,26 @@
 
     <!-- 根据roleCode获取roleId -->
     <select id="getRoleIdByRoleCode" resultType="java.lang.String">
-		select
-		id
-		from sys_role
-		where role_code = #{roleCode}
-	</select>
+        select id
+        from sys_role
+        where role_code = #{roleCode}
+    </select>
 
     <!-- 根据userId获取角色code -->
     <select id="getRoleCodeByUserId" resultType="java.lang.String">
-		select
-		c.role_code
-		from
-		sys_user a
-		left join sys_user_role b on a.id = b.user_id
-		left join sys_role c on b.role_id = c.id
-        where
-        a.id = #{userId}
-	</select>
+        select c.role_code
+        from sys_user a
+                 left join sys_user_role b on a.id = b.user_id
+                 left join sys_role c on b.role_id = c.id
+        where a.id = #{userId}
+    </select>
+
+
+    <select id="queryRoleByUserId" resultType="cn.com.ctop.common.module.entity.SysRole">
+        SELECT t2.role_name,t2.role_code
+        FROM sys_user_role t1
+                 LEFT JOIN sys_role t2 ON t1.role_id = t2.id
+        WHERE t1.user_id = #{userId} LIMIT 1
+    </select>
 
 </mapper>

+ 16 - 7
module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/SysUserDepartMapper.xml

@@ -2,17 +2,26 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="cn.com.ctop.common.module.mapper.SysUserDepartMapper">
     <select id="getUserDepartByUid" parameterType="String" resultType="cn.com.ctop.common.module.entity.SysUserDepart">
-		SELECT *
-		FROM sys_user_depart
-		WHERE user_id = #{userId, jdbcType=VARCHAR}
+        SELECT *
+        FROM sys_user_depart
+        WHERE user_id = #{userId, jdbcType=VARCHAR}
     </select>
 
     <select id="getUserDepartByUserId" parameterType="String"
             resultType="cn.com.ctop.common.module.entity.SysUserDepart">
-		SELECT *
-		FROM sys_user_depart
-		WHERE user_id = #{userId, jdbcType=VARCHAR}
-		limit 1
+        SELECT *
+        FROM sys_user_depart
+        WHERE user_id = #{userId, jdbcType=VARCHAR} limit 1
+    </select>
+
+    <select id="getUserIds" resultType="java.lang.String">
+        SELECT user_id
+        FROM sys_user_depart
+        WHERE dep_id IN
+        <foreach item="id" index="index" collection="ids"
+                 open="(" separator="," close=")">
+            #{id}
+        </foreach>
     </select>
 
 </mapper>

+ 3 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/IMaterialInfoService.java

@@ -1,6 +1,7 @@
 package cn.com.ctop.common.module.service;
 
 import cn.com.ctop.common.module.entity.MaterialInfo;
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.service.IService;
 import org.apache.ibatis.annotations.Param;
@@ -78,4 +79,6 @@ public interface IMaterialInfoService extends IService<MaterialInfo> {
     List<MaterialInfo> getListByDate(String startDate, String endDate);
 
     Map<String, Object> getListByParams(String tagCode, String type, Integer status, List<Long> projectIds, String materialName, String code, String startDate, String endDate, String userId, Integer pageNo, Integer pageSize);
+
+    JSONArray getIdListByProject(Long projectId);
 }

+ 1 - 1
module-common/src/main/java/cn/com/ctop/common/module/service/impl/FileInfoServiceImpl.java

@@ -51,7 +51,7 @@ public class FileInfoServiceImpl extends ServiceImpl<FileInfoMapper, FileInfo> i
     private String imageUploadPath;
     @Value("${jeecg.path.video-upload}")
     private String videoUploadPath;
-    @Autowired
+    @Resource
     FileInfoMapper fileInfoMapper;
     @Resource
     private ICtopOauthTokenService ctopOauthTokenService;

+ 10 - 7
module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialInfoServiceImpl.java

@@ -55,13 +55,13 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
     private ITencentWatermarkTemplateService tencentWatermarkTemplateService;
     @Resource
     private IVideoWatermarkTaskService videoWatermarkTaskService;
-    @Autowired
+    @Resource
     private MaterialInfoMapper materialInfoMapper;
-    @Autowired
+    @Resource
     private MaterialParameterMapper materialParameterMapper;
-    @Autowired
+    @Resource
     private MaterialAscriptionMapper materialAscriptionMapper;
-    @Autowired
+    @Resource
     private MaterialTagMapper materialTagMapper;
     @Resource
     private IMaterialCutFrameService materialCutFrameService;
@@ -309,7 +309,6 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
     @Override
     public JSONObject getDetail(String materialId) {
         JSONObject json = new JSONObject();
-
         MaterialInfo materialInfo = this.getById(materialId);
         if (!Check.isNull(materialInfo.getAuditorId())) {
             String auditorName = materialInfoMapper.selectUserNameById(materialInfo.getAuditorId());
@@ -336,7 +335,6 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
         if (!Check.isNull(ascriptionJson)) {
             json.put("ascription", ascriptionJson);
         }
-
         return json;
     }
 
@@ -510,7 +508,7 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
             info.setProjectId(projectId);
             info.setWatermarkCode(json.getString("watermarkCode"));
             info.setStatus(0);
-            info.setMaterialName(json.getString("materialName"));
+            info.setMaterialName(StringUtils.getFileNameNoEx(json.getString("materialName")));
             info.setWatermarkMaterialName(json.getString("watermarkMaterialName"));
             info.setMaterialDescribe(json.getString("materialDescribe"));
             info.setCreateTime(new Date());
@@ -820,6 +818,11 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
         ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
         return result;
     }
+
+    @Override
+    public JSONArray getIdListByProject(Long projectId) {
+        return materialInfoMapper.getIdListByProject(projectId);
+    }
 }
 
 

+ 794 - 0
module-common/src/main/java/cn/com/ctop/common/module/utils/ConverterUtils.java

@@ -0,0 +1,794 @@
+package cn.com.ctop.common.module.utils;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.text.NumberFormat;
+import java.text.ParseException;
+
+/**
+ * A simple object converter
+ * <br>
+ * 一个简单的数据类型转换工具类
+ */
+public class ConverterUtils {
+
+    public static void main(String[] args) {
+        Long asLong = ConverterUtils.getAsLong("12121.3444");
+        System.err.println(asLong);
+    }
+
+
+    /**
+     * Gets a String from a Object in a null-safe manner.
+     * <p>
+     * The String is obtained via <code>toString</code>.
+     *
+     * @param obj the object to use
+     * @return the value of the Object as a String, <code>null</code> if null object input
+     */
+    public static String getAsString(final Object obj) {
+        if (obj != null) {
+            return obj.toString();
+        }
+        return null;
+    }
+
+    /**
+     * Gets a String from a Object in a null-safe manner.
+     * <p>
+     * The String is obtained via <code>toString</code>.
+     *
+     * @param obj          the object to use
+     * @param defaultValue what to return if the value is null or if the conversion fails
+     * @return the value of the Object as a String, <code>defaultValue</code> if null object input
+     */
+    public static String getAsString(final Object obj, final String defaultValue) {
+        String answer = getAsString(obj);
+        if (answer == null) {
+            answer = defaultValue;
+        }
+        return answer;
+    }
+
+    /**
+     * Gets a Number from a Object in a null-safe manner.
+     * <p>
+     * If the value is a <code>Number</code> it is returned directly.
+     * If the value is a <code>String</code> it is converted using
+     * {@link NumberFormat#parse(String)} on the system default formatter
+     * returning <code>null</code> if the conversion fails.
+     * Otherwise, <code>null</code> is returned.
+     *
+     * @param obj the object to use
+     * @return the value of the Object as a Number, <code>null</code> if null object input
+     */
+    public static Number getAsNumber(final Object obj) {
+        if (obj != null) {
+            if (obj instanceof Number) {
+                return (Number) obj;
+            } else if (obj instanceof Boolean) {
+                return ((Boolean) obj) ? 1 : 0;
+            } else if (obj instanceof String) {
+                try {
+                    return NumberFormat.getInstance().parse((String) obj);
+                } catch (final ParseException e) {
+                    throw new NumberFormatException("For input string: \"" + obj + "\"");
+                }
+            } else {
+                throw new UnsupportedOperationException();
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Converting the Object into a number,
+     * using the default value if the the conversion fails.
+     *
+     * @param obj          the object to use
+     * @param defaultValue what to return if the value is null or if the conversion fails
+     * @return the value of the object as a number, or defaultValue if the
+     * original value is null, the object is null or the number conversion
+     * fails
+     */
+    @SuppressWarnings("unchecked")
+    public static <R extends Number> R getAsNumber(final Object obj, R defaultValue) {
+        Number answer = getAsNumber(obj);
+        if (answer == null) {
+            answer = defaultValue;
+        }
+        return (R) answer;
+    }
+
+    /**
+     * Gets a Boolean from a Object in a null-safe manner.
+     * <p>
+     * If the value is a <code>Boolean</code> it is returned directly.
+     * If the value is a <code>String</code> and it equals 'true' ignoring case
+     * then <code>true</code> is returned, otherwise <code>false</code>.
+     * If the value is a <code>Number</code> an integer zero value returns
+     * <code>false</code> and non-zero returns <code>true</code>.
+     * Otherwise, <code>null</code> is returned.
+     *
+     * @param obj the object to use
+     * @return the value of the Object as a Boolean, <code>null</code> if null object input
+     */
+    public static Boolean getAsBoolean(final Object obj) {
+        if (obj != null) {
+            if (obj instanceof Boolean) {
+                return (Boolean) obj;
+            } else if (obj instanceof String) {
+                return Boolean.valueOf((String) obj);
+            } else if (obj instanceof Number) {
+                final Number n = (Number) obj;
+                return (n.intValue() != 0) ? Boolean.TRUE : Boolean.FALSE;
+            } else {
+                throw new UnsupportedOperationException();
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Gets a Boolean from a Object in a null-safe manner.
+     * <p>
+     * If the value is a <code>Boolean</code> it is returned directly.
+     * If the value is a <code>String</code> and it equals 'true' ignoring case
+     * then <code>true</code> is returned, otherwise <code>false</code>.
+     * If the value is a <code>Number</code> an integer zero value returns
+     * <code>false</code> and non-zero returns <code>true</code>.
+     * Otherwise, <code>null</code> is returned.
+     *
+     * @param obj          the object to use
+     * @param defaultValue what to return if the value is null or if the conversion fails
+     * @return the value of the Object as a Boolean, <code>defaultValue</code> if null object input
+     */
+    public static Boolean getAsBoolean(final Object obj, final Boolean defaultValue) {
+        Boolean answer = getAsBoolean(obj);
+        if (answer == null) {
+            answer = defaultValue;
+        }
+        return answer;
+    }
+
+    /**
+     * Gets a boolean from a Object in a null-safe manner.
+     * <p>
+     * If the value is a <code>Boolean</code> its value is returned.
+     * If the value is a <code>String</code> and it equals 'true' ignoring case
+     * then <code>true</code> is returned, otherwise <code>false</code>.
+     * If the value is a <code>Number</code> an integer zero value returns
+     * <code>false</code> and non-zero returns <code>true</code>.
+     * Otherwise, <code>false</code> is returned.
+     *
+     * @param obj the object to use
+     * @return the value of the Object as a Boolean, <code>false</code> if null object input
+     */
+    public static boolean getAsBooleanValue(final Object obj) {
+        final Boolean booleanObject = getAsBoolean(obj);
+        if (booleanObject == null) {
+            return false;
+        }
+        return booleanObject.booleanValue();
+    }
+
+    /**
+     * Gets a boolean from a Object in a null-safe manner.
+     * <p>
+     * If the value is a <code>Boolean</code> its value is returned.
+     * If the value is a <code>String</code> and it equals 'true' ignoring case
+     * then <code>true</code> is returned, otherwise <code>false</code>.
+     * If the value is a <code>Number</code> an integer zero value returns
+     * <code>false</code> and non-zero returns <code>true</code>.
+     * Otherwise, <code>false</code> is returned.
+     *
+     * @param obj          the object to use
+     * @param defaultValue what to return if the value is null or if the conversion fails
+     * @return the value in the Map as a Boolean, <code>defaultValue</code> if null object input
+     */
+    public static boolean getAsBooleanValue(final Object obj, final boolean defaultValue) {
+        final Boolean booleanObject = getAsBoolean(obj);
+        if (booleanObject == null) {
+            return defaultValue;
+        }
+        return booleanObject.booleanValue();
+    }
+
+    /**
+     * Gets a Byte from a Object in a null-safe manner,
+     * using the default value if the the conversion fails.
+     * <p>
+     * The Byte is obtained from the results of {@link #getAsNumber(Object)}.
+     *
+     * @param obj the object to use
+     * @return the value of Object as a Byte, <code>null</code> if null object input
+     */
+    public static Byte getAsByte(final Object obj) {
+        final Number answer = getAsNumber(obj);
+        if (answer == null) {
+            return null;
+        } else if (answer instanceof Byte) {
+            return (Byte) answer;
+        }
+        return Byte.valueOf(answer.byteValue());
+    }
+
+    /**
+     * Gets a Byte from a Object in a null-safe manner,
+     * using the default value if the the conversion fails.
+     * <p>
+     * The Byte is obtained from the results of {@link #getAsNumber(Object)}.
+     *
+     * @param obj          the object to use
+     * @param defaultValue return if the value is null or if the conversion fails
+     * @return the value of Object as a Byte, <code>defaultValue</code> if null object input
+     */
+    public static Byte getAsByte(final Object obj, final Byte defaultValue) {
+        Byte answer = getAsByte(obj);
+        if (answer == null) {
+            answer = defaultValue;
+        }
+        return answer;
+    }
+
+    /**
+     * Gets a byte from a Object in a null-safe manner.
+     * <p>
+     * The byte is obtained from the results of {@link #getAsNumber(Object)}.
+     *
+     * @param obj the object to use
+     * @return the value of the Object as a byte, <code>0</code> if null object input
+     */
+    public static byte getAsByteValue(final Object obj) {
+        final Byte byteObject = getAsByte(obj);
+        if (byteObject == null) {
+            return 0;
+        }
+        return byteObject.byteValue();
+    }
+
+    /**
+     * Gets a byte from a Object in a null-safe manner.
+     * <p>
+     * The byte is obtained from the results of {@link #getAsNumber(Object)}.
+     *
+     * @param obj          the object to use
+     * @param defaultValue return if the value is null or if the conversion fails
+     * @return the value of the Object as a byte, <code>defaultValue</code> if null object input
+     */
+    public static byte getAsByteValue(final Object obj, final byte defaultValue) {
+        final Byte byteObject = getAsByte(obj);
+        if (byteObject == null) {
+            return defaultValue;
+        }
+        return byteObject.byteValue();
+    }
+
+    /**
+     * Gets a Short from a Object in a null-safe manner.
+     * <p>
+     * The Short is obtained from the results of {@link #getAsNumber(Object)}.
+     *
+     * @param obj the object to use
+     * @return the value of the Object as a Short, <code>null</code> if null object input
+     */
+    public static Short getAsShort(final Object obj) {
+        final Number answer = getAsNumber(obj);
+        if (answer == null) {
+            return null;
+        } else if (answer instanceof Short) {
+            return (Short) answer;
+        }
+        return Short.valueOf(answer.shortValue());
+    }
+
+    /**
+     * Gets a Short from a Object in a null-safe manner,
+     * using the default value if the the conversion fails.
+     * <p>
+     * The Short is obtained from the results of {@link #getAsNumber(Object)}.
+     *
+     * @param obj          the object to use
+     * @param defaultValue return if the value is null or if the conversion fails
+     * @return the value of Object as a Short, <code>defaultValue</code> if null object input
+     */
+    public static Short getAsShort(final Object obj, final Short defaultValue) {
+        Short answer = getAsShort(obj);
+        if (answer == null) {
+            answer = defaultValue;
+        }
+        return answer;
+    }
+
+    /**
+     * Gets a short from a Object in a null-safe manner.
+     * <p>
+     * The short is obtained from the results of {@link #getAsNumber(Object)}.
+     *
+     * @param obj the object to use
+     * @return the value of the Object as a short, <code>0</code> if null object input
+     */
+    public static short getAsShortValue(final Object obj) {
+        final Short shortObject = getAsShort(obj);
+        if (shortObject == null) {
+            return 0;
+        }
+        return shortObject.shortValue();
+    }
+
+    /**
+     * Gets a short from a Object in a null-safe manner.
+     * <p>
+     * The short is obtained from the results of {@link #getAsNumber(Object)}.
+     *
+     * @param obj          the object to use
+     * @param defaultValue return if the value is null or if the conversion fails
+     * @return the value of the Object as a short, <code>defaultValue</code> if null object input
+     */
+    public static short getAsShortValue(final Object obj, final short defaultValue) {
+        final Short shortObject = getAsShort(obj);
+        if (shortObject == null) {
+            return defaultValue;
+        }
+        return shortObject.shortValue();
+    }
+
+    /**
+     * Gets a Integer from a Object in a null-safe manner.
+     * <p>
+     * The Integer is obtained from the results of {@link #getAsNumber(Object)}.
+     *
+     * @param obj the object to use
+     * @return the value of the Object as a Integer, <code>null</code> if null object input
+     */
+    public static Integer getAsInteger(final Object obj) {
+        final Number answer = getAsNumber(obj);
+        if (Check.isNull(answer)) {
+            return null;
+        } else if (answer instanceof Integer) {
+            return (Integer) answer;
+        }
+        return Integer.valueOf(answer.intValue());
+    }
+
+    /**
+     * Gets a Integer from a Object in a null-safe manner,
+     * using the default value if the the conversion fails.
+     * <p>
+     * The Integer is obtained from the results of {@link #getAsNumber(Object)}.
+     *
+     * @param obj          the object to use
+     * @param defaultValue return if the value is null or if the conversion fails
+     * @return the value of Object as a Integer, <code>defaultValue</code> if null object input
+     */
+    public static Integer getAsInteger(final Object obj, final Integer defaultValue) {
+        Integer answer = getAsInteger(obj);
+        if (answer == null) {
+            answer = defaultValue;
+        }
+        return answer;
+    }
+
+    /**
+     * Gets a int from a Object in a null-safe manner.
+     * <p>
+     * The int is obtained from the results of {@link #getAsNumber(Object)}.
+     *
+     * @param obj the object to use
+     * @return the value of the Object as a int, <code>0</code> if null object input
+     */
+    public static int getAsIntValue(final Object obj) {
+        final Integer integerObject = getAsInteger(obj);
+        if (integerObject == null) {
+            return 0;
+        }
+        return integerObject.intValue();
+    }
+
+    /**
+     * Gets a int from a Object in a null-safe manner.
+     * <p>
+     * The int is obtained from the results of {@link #getAsNumber(Object)}.
+     *
+     * @param obj          the object to use
+     * @param defaultValue return if the value is null or if the conversion fails
+     * @return the value of the Object as a int, <code>defaultValue</code> if null object input
+     */
+    public static int getAsIntValue(final Object obj, final int defaultValue) {
+        final Integer integerObject = getAsInteger(obj);
+        if (integerObject == null) {
+            return defaultValue;
+        }
+        return integerObject.intValue();
+    }
+
+    /**
+     * Gets a Long from a Object in a null-safe manner.
+     * <p>
+     * The Long is obtained from the results of {@link #getAsNumber(Object)}.
+     *
+     * @param obj the object to use
+     * @return the value of the Object as a Long, <code>null</code> if null object input
+     */
+    public static Long getAsLong(final Object obj) {
+        final Number answer = getAsNumber(obj);
+        if (Check.isNull(answer)) {
+            return null;
+        } else if (answer instanceof Long) {
+            return (Long) answer;
+        }
+        return Long.valueOf(answer.longValue());
+    }
+
+    /**
+     * Gets a Long from a Object in a null-safe manner,
+     * using the default value if the the conversion fails.
+     * <p>
+     * The Long is obtained from the results of {@link #getAsNumber(Object)}.
+     *
+     * @param obj          the object to use
+     * @param defaultValue return if the value is null or if the conversion fails
+     * @return the value of Object as a Long, <code>defaultValue</code> if null object input
+     */
+    public static Long getAsLong(final Object obj, final Long defaultValue) {
+        Long answer = getAsLong(obj);
+        if (answer == null) {
+            answer = defaultValue;
+        }
+        return answer;
+    }
+
+    /**
+     * Gets a long from a Object in a null-safe manner.
+     * <p>
+     * The long is obtained from the results of {@link #getAsNumber(Object)}.
+     *
+     * @param obj the object to use
+     * @return the value of the Object as a long, <code>0L</code> if null object input
+     */
+    public static long getAsLongValue(final Object obj) {
+        final Long longObject = getAsLong(obj);
+        if (longObject == null) {
+            return 0L;
+        }
+        return longObject.longValue();
+    }
+
+    /**
+     * Gets a long from a Object in a null-safe manner,
+     * using the default value if the the conversion fails.
+     * <p>
+     * The long is obtained from the results of {@link #getAsNumber(Object)}.
+     *
+     * @param obj          the object to use
+     * @param defaultValue return if the value is null or if the conversion fails
+     * @return the value of Object as a long, <code>defaultValue</code> if null object input
+     */
+    public static long getAsLongValue(final Object obj, final long defaultValue) {
+        final Long longObject = getAsLong(obj);
+        if (longObject == null) {
+            return defaultValue;
+        }
+        return longObject.longValue();
+    }
+
+    /**
+     * Gets a Float from a Object in a null-safe manner.
+     * <p>
+     * The Float is obtained from the results of {@link #getAsNumber(Object)}.
+     *
+     * @param obj the object to use
+     * @return the value of the Object as a Float, <code>null</code> if null object input
+     */
+    public static Float getAsFloat(final Object obj) {
+        final Number answer = getAsNumber(obj);
+        if (answer == null) {
+            return null;
+        } else if (answer instanceof Float) {
+            return (Float) answer;
+        }
+        return Float.valueOf(answer.floatValue());
+    }
+
+    /**
+     * Gets a Float from a Object in a null-safe manner,
+     * using the default value if the the conversion fails.
+     * <p>
+     * The Float is obtained from the results of {@link #getAsNumber(Object)}.
+     *
+     * @param obj          the object to use
+     * @param defaultValue return if the value is null or if the conversion fails
+     * @return the value of Object as a Float, <code>defaultValue</code> if null object input
+     */
+    public static Float getAsFloat(final Object obj, final Float defaultValue) {
+        Float answer = getAsFloat(obj);
+        if (answer == null) {
+            answer = defaultValue;
+        }
+        return answer;
+    }
+
+    /**
+     * Gets a float from a Object in a null-safe manner.
+     * <p>
+     * The float is obtained from the results of {@link #getAsNumber(Object)}.
+     *
+     * @param obj the object to use
+     * @return the value of Object as a float, <code>0.0F</code> if null object input
+     */
+    public static float getAsFloatValue(final Object obj) {
+        final Float floatObject = getAsFloat(obj);
+        if (floatObject == null) {
+            return 0f;
+        }
+        return floatObject.floatValue();
+    }
+
+    /**
+     * Gets a float from a Object in a null-safe manner,
+     * using the default value if the the conversion fails.
+     * <p>
+     * The float is obtained from the results of {@link #getAsNumber(Object)}.
+     *
+     * @param obj          the object to use
+     * @param defaultValue return if the value is null or if the conversion fails
+     * @return the value of Object as a float, <code>defaultValue</code> if null object input
+     */
+    public static float getAsFloatValue(final Object obj, final float defaultValue) {
+        final Float floatObject = getAsFloat(obj);
+        if (floatObject == null) {
+            return defaultValue;
+        }
+        return floatObject.floatValue();
+    }
+
+    /**
+     * Gets a Double from a Object in a null-safe manner.
+     * <p>
+     * The Double is obtained from the results of {@link #getAsNumber(Object)}.
+     *
+     * @param obj the object to use
+     * @return the value of the Object as a Double, <code>null</code> if null object input
+     */
+    public static Double getAsDouble(final Object obj) {
+        final Number answer = getAsNumber(obj);
+        if (Check.isNull(answer)) {
+            return null;
+        } else if (answer instanceof Double) {
+            return (Double) answer;
+        }
+        return Double.valueOf(answer.doubleValue());
+    }
+
+    /**
+     * Gets a Double from a Object in a null-safe manner,
+     * using the default value if the the conversion fails.
+     * <p>
+     * The Double is obtained from the results of {@link #getAsNumber(Object)}.
+     *
+     * @param obj          the object to use
+     * @param defaultValue return if the value is null or if the conversion fails
+     * @return the value of Object as a Double, <code>defaultValue</code> if null object input
+     */
+    public static Double getAsDouble(final Object obj, final Double defaultValue) {
+        Double answer = getAsDouble(obj);
+        if (answer == null) {
+            answer = defaultValue;
+        }
+        return answer;
+    }
+
+    /**
+     * Gets a double from a Object in a null-safe manner.
+     * <p>
+     * The double is obtained from the results of {@link #getAsNumber(Object)}.
+     *
+     * @param obj the object to use
+     * @return the value of Object as a double, <code>0.0</code> if null object input
+     */
+    public static double getAsDoubleValue(final Object obj) {
+        final Double doubleObject = getAsDouble(obj);
+        if (doubleObject == null) {
+            return 0d;
+        }
+        return doubleObject.doubleValue();
+    }
+
+    /**
+     * Gets a double from a Object in a null-safe manner,
+     * using the default value if the the conversion fails.
+     * <p>
+     * The double is obtained from the results of {@link #getAsNumber(Object)}.
+     *
+     * @param obj          the object to use
+     * @param defaultValue return if the value is null or if the conversion fails
+     * @return the value of Object as a double, <code>defaultValue</code> if null object input
+     */
+    public static double getAsDoubleValue(final Object obj, final double defaultValue) {
+        final Double doubleObject = getAsDouble(obj);
+        if (doubleObject == null) {
+            return defaultValue;
+        }
+        return doubleObject.doubleValue();
+    }
+
+    /**
+     * Gets a BigInteger from a Object in a null-safe manner.
+     * <p>
+     * The BigInteger is obtained from the results of {@link #getAsNumber(Object)}.
+     *
+     * @param obj the object to use
+     * @return the value of Object as a BigInteger, <code>0</code> if null object input
+     */
+    public static BigInteger getAsBigInteger(final Object obj) {
+        if (obj != null) {
+            if (obj instanceof BigInteger) {
+                return (BigInteger) obj;
+            } else if (obj instanceof String) {
+                return new BigInteger((String) obj);
+            } else if (obj instanceof Number || obj instanceof Boolean) {
+                final Number answer = getAsNumber(obj);
+                if (answer != null) {
+                    return BigInteger.valueOf(answer.longValue());
+                }
+            } else {
+                throw new UnsupportedOperationException();
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Gets a BigInteger from a Object in a null-safe manner,
+     * using the default value if the the conversion fails.
+     * <p>
+     * The BigInteger is obtained from the results of {@link #getAsNumber(Object)}.
+     *
+     * @param obj          the object to use
+     * @param defaultValue return if the value is null or if the conversion fails
+     * @return the value of Object as a BigInteger, <code>defaultValue</code> if null object input
+     */
+    @SuppressWarnings("unchecked")
+    public static <R extends BigInteger> R getAsBigInteger(final Object obj, final R defaultValue) {
+        BigInteger answer = getAsBigInteger(obj);
+        if (answer == null) {
+            answer = defaultValue;
+        }
+        return (R) answer;
+    }
+
+    /**
+     * Gets a BigDecimal from a Object in a null-safe manner.
+     * <p>
+     * The BigDecimal is obtained from the results of {@link #getAsNumber(Object)}.
+     *
+     * @param obj the object to use
+     * @return the value of Object as a BigDecimal, <code>0</code> if null object input
+     */
+    public static BigDecimal getAsBigDecimal(final Object obj) {
+        if (!Check.isNull(obj)) {
+            if (obj instanceof BigDecimal) {
+                return (BigDecimal) obj;
+            } else if (obj instanceof String) {
+                return new BigDecimal((String) obj);
+            } else if (obj instanceof Number || obj instanceof Boolean) {
+                final Number answer = getAsNumber(obj);
+                if (answer != null) {
+                    return BigDecimal.valueOf(answer.doubleValue());
+                }
+            } else {
+                throw new UnsupportedOperationException();
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Gets a BigDecimal from a Object in a null-safe manner,
+     * using the default value if the the conversion fails.
+     * <p>
+     * The BigDecimal is obtained from the results of {@link #getAsNumber(Object)}.
+     *
+     * @param obj          the object to use
+     * @param defaultValue return if the value is null or if the conversion fails
+     * @return the value of Object as a BigDecimal, <code>defaultValue</code> if null object input
+     */
+    @SuppressWarnings("unchecked")
+    public static <R extends BigDecimal> R getAsBigDecimal(final Object obj, final R defaultValue) {
+        BigDecimal answer = getAsBigDecimal(obj);
+        if (answer == null) {
+            answer = defaultValue;
+        }
+        return (R) answer;
+    }
+
+    /**
+     * This method is mainly used to provide data type conversion services.
+     *
+     * @param obj the object to use
+     * @param clz the type for conversion
+     * @return
+     */
+    @SuppressWarnings("unchecked")
+    public static <R> R cast(final Object obj, final Class<R> clz) {
+        if (obj == null) {
+            throw new IllegalArgumentException("'obj' must not be null");
+        }
+        if (clz == null) {
+            throw new IllegalArgumentException("'clz' must not be null");
+        }
+        R result = null;
+        if (Boolean.class.equals(clz) || boolean.class.equals(clz)) {
+            result = (R) getAsBoolean(obj);
+        } else if (Byte.class.equals(clz) || byte.class.equals(clz)) {
+            result = (R) getAsByte(obj);
+        } else if (Short.class.equals(clz) || short.class.equals(clz)) {
+            result = (R) getAsShort(obj);
+        } else if (Integer.class.equals(clz) || int.class.equals(clz)) {
+            result = (R) getAsInteger(obj);
+        } else if (Long.class.equals(clz) || long.class.equals(clz)) {
+            result = (R) getAsLong(obj);
+        } else if (Float.class.equals(clz) || float.class.equals(clz)) {
+            result = (R) getAsFloat(obj);
+        } else if (Double.class.equals(clz) || double.class.equals(clz)) {
+            result = (R) getAsDouble(obj);
+        } else if (String.class.equals(clz)) {
+            result = (R) getAsString(obj);
+        } else if (BigInteger.class.isAssignableFrom(clz)) {
+            result = (R) getAsBigInteger(obj);
+        } else if (BigDecimal.class.isAssignableFrom(clz)) {
+            result = (R) getAsBigDecimal(obj);
+        } else if (Number.class.isAssignableFrom(clz)) {
+            result = (R) getAsNumber(obj);
+        } else {
+            throw new UnsupportedOperationException();
+        }
+        return result;
+    }
+
+    /**
+     * This method is mainly used to provide data type conversion services.
+     *
+     * @param obj          the object to use
+     * @param defaultValue return if the value is null or if the conversion fails
+     * @return
+     */
+    @SuppressWarnings("unchecked")
+    public static <R> R cast(final Object obj, final R defaultValue) {
+        if (obj == null) {
+            throw new IllegalArgumentException("'obj' must not be null");
+        }
+        if (defaultValue == null) {
+            throw new IllegalArgumentException("'defaultValue' must not be null");
+        }
+        R result = null;
+        final Class<?> clz = defaultValue.getClass();
+        if (Boolean.class.equals(clz) || boolean.class.equals(clz)) {
+            result = (R) getAsBoolean(obj, (Boolean) defaultValue);
+        } else if (Byte.class.equals(clz) || byte.class.equals(clz)) {
+            result = (R) getAsByte(obj, (Byte) defaultValue);
+        } else if (Short.class.equals(clz) || short.class.equals(clz)) {
+            result = (R) getAsShort(obj, (Short) defaultValue);
+        } else if (Integer.class.equals(clz) || int.class.equals(clz)) {
+            result = (R) getAsInteger(obj, (Integer) defaultValue);
+        } else if (Long.class.equals(clz) || long.class.equals(clz)) {
+            result = (R) getAsLong(obj, (Long) defaultValue);
+        } else if (Float.class.equals(clz) || float.class.equals(clz)) {
+            result = (R) getAsFloat(obj, (Float) defaultValue);
+        } else if (Double.class.equals(clz) || double.class.equals(clz)) {
+            result = (R) getAsDouble(obj, (Double) defaultValue);
+        } else if (String.class.equals(clz)) {
+            result = (R) getAsString(obj, (String) defaultValue);
+        } else if (BigInteger.class.isAssignableFrom(clz)) {
+            result = (R) getAsBigInteger(obj, (BigInteger) defaultValue);
+        } else if (BigDecimal.class.isAssignableFrom(clz)) {
+            result = (R) getAsBigDecimal(obj, (BigDecimal) defaultValue);
+        } else if (Number.class.isAssignableFrom(clz)) {
+            result = (R) getAsNumber(obj, (Number) defaultValue);
+        } else {
+            throw new UnsupportedOperationException();
+        }
+        return result;
+    }
+
+}

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

@@ -120,6 +120,10 @@ public class KuaishouInterfaceConstant {
      * 创建广告获取应用列表(新版本)
      */
     public static final String APP_LIST_v2 = "/rest/openapi/v2/file/ad/app/list";
+    /**
+     * 获取app名称
+     */
+    public static final String APP_NAME = "/rest/openapi/v1/tool/keyword/query";
 
     /**
      * 账户日预算查询

+ 10 - 0
module-common/src/main/java/cn/com/ctop/common/module/utils/StringUtils.java

@@ -21,6 +21,16 @@ public class StringUtils {
         return list;
     }
 
+    public static String getFileNameNoEx(String filename) {
+        if ((filename != null) && (filename.length() > 0)) {
+            int dot = filename.lastIndexOf('.');
+            if ((dot >-1) && (dot < (filename.length()))) {
+                return filename.substring(0, dot);
+            }
+        }
+        return filename;
+    }
+
     /**
      * 将下划线风格转换为驼峰风格
      * @param inputString

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

@@ -0,0 +1,18 @@
+package cn.com.ctop.job.bytedance.handler;
+
+import cn.com.ctop.common.module.utils.HttpUtils;
+import com.xxl.job.core.handler.annotation.XxlJob;
+import org.jeecg.common.util.DateUtils;
+import org.springframework.stereotype.Component;
+
+import java.util.Date;
+
+@Component
+public class BytedanceAiCreateJob {
+    private static final String URLPREFIX = "http://118.24.244.213:8080/bytedance-api/advertiser/aiBytedanceAdvertiserStrategy/autoCreateCreative?hour=";
+    @XxlJob("bytedanceAutoCreateJob")
+    public void execute() throws Exception {
+        String hour = DateUtils.getNowHour(new Date());
+        HttpUtils.httpGet(URLPREFIX + hour, null, null);
+    }
+}

+ 16 - 0
module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceEtlVideoJob.java

@@ -1,6 +1,7 @@
 package cn.com.ctop.job.bytedance.handler;
 
 import cn.com.ctop.toutiao.modules.report.service.IBytedanceVideoEtlInfoService;
+import cn.com.ctop.toutiao.modules.report.service.IEtlBytedanceReportVideoDailyService;
 import com.xxl.job.core.handler.annotation.XxlJob;
 import org.jeecg.common.util.DateUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -13,6 +14,10 @@ public class BytedanceEtlVideoJob {
 
     @Autowired
     private IBytedanceVideoEtlInfoService bytedanceVideoEtlInfoService;
+
+    @Autowired
+    private IEtlBytedanceReportVideoDailyService etlBytedanceReportVideoDailyService;
+
     @XxlJob("bytedanceEtlVideoJob")
     public void execute() throws Exception {
         Date startDate = DateUtils.addDay(new Date(),-2);
@@ -30,4 +35,15 @@ public class BytedanceEtlVideoJob {
             bytedanceVideoEtlInfoService.etlBytedanceVideoInfoByProjectId(getDate);
         }
     }
+
+
+    @XxlJob("updBytedanceVideoJob")
+    public void updBytedanceVideoJob() throws Exception {
+        etlBytedanceReportVideoDailyService.updBytedanceVideo();
+    }
+
+    @XxlJob("etlBytedanceVideoJob")
+    public void etlBytedanceVideoJob() throws Exception {
+        etlBytedanceReportVideoDailyService.etlBytedanceVideo();
+    }
 }

+ 3 - 0
module-job-bytedance/src/main/resources/application-dev.yml

@@ -212,3 +212,6 @@ xxl:
       logretentiondays: 30
     admin:
       addresses: http://127.0.0.1:8090/xxl-job-admin
+zip:
+  local:
+    download-path: /data/unzip/

+ 3 - 0
module-job-bytedance/src/main/resources/application-jiaoyang.yml

@@ -227,3 +227,6 @@ xxl:
       logretentiondays: 30
     admin:
       addresses: http://129.28.150.229:8090/xxl-job-admin
+zip:
+  local:
+    download-path: /data/unzip/

+ 3 - 0
module-job-bytedance/src/main/resources/application-prod.yml

@@ -231,3 +231,6 @@ ai:
   callback:
     callback-unit-url: http://192.168.1.193:31012/ai_callback_add_group
     callback-creative-url: http://192.168.1.193:31012/ai_callback_add_creative
+zip:
+  local:
+    download-path: /data/unzip/

+ 3 - 0
module-job-bytedance/src/main/resources/application-test.yml

@@ -236,3 +236,6 @@ xxl:
       logretentiondays: 30
     admin:
       addresses: http://127.0.0.1:8090/xxl-job-admin
+zip:
+  local:
+    download-path: /data/unzip/

+ 7 - 0
module-job-kuaishou/pom.xml

@@ -210,6 +210,13 @@
             </properties>
         </profile>
         <profile>
+            <id>preprod</id>
+            <properties>
+                <activatedProperties>preprod</activatedProperties>
+            </properties>
+        </profile>
+
+        <profile>
             <id>jiaoyang</id>
             <properties>
                 <activatedProperties>jiaoyang</activatedProperties>

+ 64 - 0
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaiShouBudgetJob.java

@@ -0,0 +1,64 @@
+package cn.com.ctop.job.kuaishou.handler;
+
+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.app.entity.KuaishouAccountBalanceBudget;
+import cn.com.ctop.kuaishou.modules.app.service.IKuaishouAccountBalanceBudgetService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouAccountBudgetService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
+import com.alibaba.fastjson.JSONObject;
+import com.xxl.job.core.context.XxlJobHelper;
+import com.xxl.job.core.handler.annotation.XxlJob;
+import org.jeecg.common.util.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+@Component
+public class KuaiShouBudgetJob {
+    @Autowired
+    private IKuaishouAccountBalanceBudgetService balanceBudgetService;
+    @Autowired
+    private IKuaishouInterfaceService iKuaishouInterfaceService;
+    @Autowired
+    private ICtopOauthTokenService tokenService;
+    @Autowired
+    private IKuaishouAccountBudgetService accountBudgetService;
+
+    static ExecutorService executorService = Executors.newFixedThreadPool(8);
+
+    /**
+     * 定时更新快手账户余额和预算
+     *
+     * @throws
+     */
+    @XxlJob("kuaiShouBudgetJob")
+    public void execute() throws Exception {
+        if (DateUtils.getNowHour() == 2) {
+            //每日凌晨2点将预算全部置为无效,避免已关闭的账户留有僵尸数据。
+            balanceBudgetService.updateAllIsInvalidState();
+        }
+        List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
+        tokens.forEach(token -> executorService.submit(() -> {
+            KuaishouAccountBalanceBudget budget = new KuaishouAccountBalanceBudget();
+            JSONObject fundJson = iKuaishouInterfaceService.fundGet(token);
+            JSONObject accountBudget = accountBudgetService.getAccountBudget(token);
+            if (!Check.isNull(accountBudget) && !Check.isNull(fundJson)) {
+                budget.setBalance(fundJson.getBigDecimal("balance"));
+                budget.setDayBudget(accountBudget.getBigDecimal("day_budget").divide(new BigDecimal(1000)).setScale(2, RoundingMode.HALF_UP));
+                budget.setDayBudgetSchedule(accountBudget.getString("day_budget_schedule"));
+                budget.setAccountId(token.getAccountId());
+                budget.setState(1);
+                balanceBudgetService.replace(budget);
+            }
+        }));
+        XxlJobHelper.log("定时更新快手账户余额和预算完成");
+    }
+}
+

+ 9 - 4
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouAiCreativeJob.java

@@ -9,6 +9,7 @@ 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;
@@ -23,6 +24,10 @@ import java.util.Map;
 @Component
 @Slf4j
 public class KuaishouAiCreativeJob {
+
+    @Value("${xxl-job.requestUrl}")
+    private String jobUrl;
+
     @Autowired
     private IAiKuaishouAdvertiserStrategyService strategyService;
 
@@ -35,7 +40,7 @@ public class KuaishouAiCreativeJob {
         if (null == strategies || strategies.isEmpty()) {
             return;
         }
-        String url = "http://api.tjyourong.com.cn/jeecg-boot/ai/create/customCreativeLimit";
+        String url = jobUrl + "/jeecg-boot/ai/create/customCreativeLimit";
         for (AiKuaishouAdvertiserStrategy strategy : strategies) {
             if (null != strategy.getOpenProgramCreate() && strategy.getOpenProgramCreate() != 1) {
                 Map<String, Object> requestMap = new HashMap<>();
@@ -68,7 +73,7 @@ public class KuaishouAiCreativeJob {
             return;
         }
         try {
-            String url = "http://api.tjyourong.com.cn/jeecg-boot/ai/create/kuaishouCustomCreativeSupplement";
+            String url = jobUrl + "/jeecg-boot/ai/create/kuaishouCustomCreativeSupplement";
             int hour = DateUtils.getNowHour();
             for (AiKuaishouAdvertiserStrategy strategy : strategies) {
                 if (null != strategy.getOpenProgramCreate() && strategy.getOpenProgramCreate() != 1) {
@@ -105,7 +110,7 @@ public class KuaishouAiCreativeJob {
         if (null == strategies || strategies.isEmpty()) {
             return;
         }
-        String url = "http://api.tjyourong.com.cn/jeecg-boot/ai/create/kuaishouProgramCreativeAuto";
+        String url = jobUrl + "/jeecg-boot/ai/create/kuaishouProgramCreativeAuto";
         for (AiKuaishouAdvertiserStrategy strategy : strategies) {
             if (null != strategy.getOpenProgramCreate() && strategy.getOpenProgramCreate() != 0) {
                 long videoCnt = strategy.getProgramUnitCnt() * 5 / 2;
@@ -141,7 +146,7 @@ public class KuaishouAiCreativeJob {
         if (null == strategies || strategies.isEmpty()) {
             return;
         }
-        String url = "http://api.tjyourong.com.cn/jeecg-boot/ai/create/autoCreateProgramHistoryTopCreative";
+        String url = jobUrl + "/jeecg-boot/ai/create/autoCreateProgramHistoryTopCreative";
         for (AiKuaishouAdvertiserStrategy strategy : strategies) {
             if (null != strategy.getOpenProgramCreate() && strategy.getOpenProgramCreate() != 0) {
                 long videoCnt = strategy.getProgramUnitCnt() * 5 / 2;

+ 6 - 2
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouCreateUnitJob.java

@@ -6,6 +6,7 @@ import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouGroupTemplateService;
 import com.xxl.job.core.context.XxlJobHelper;
 import com.xxl.job.core.handler.annotation.XxlJob;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Component;
 
 import java.util.HashMap;
@@ -18,16 +19,19 @@ public class KuaishouCreateUnitJob {
 
     @Autowired
     private IKuaiShouGroupTemplateService groupTemplateService;
+    @Value("${xxl-job.requestUrl}")
+    private String jobUrl;
 
     @XxlJob("kuaihouCreateUnit")
     public void execute() {
-
+        String url = jobUrl + "/jeecg-boot/batch/kuaiShouGroupTemplate/createUnit";
+        System.err.println("请求地址:" + url);
         List<Long> idList = groupTemplateService.getIdList();
         if (Check.isNull(idList)) {
             XxlJobHelper.log("批量2.0暂时没有未创建的组");
             return;
         }
-        String url = "http://api.tjyourong.com.cn/jeecg-boot/batch/kuaiShouGroupTemplate/createUnit";
+    //    String url = jobUrl + "/jeecg-boot/batch/kuaiShouGroupTemplate/createUnit";
         for (int i = 0; i < idList.size(); i++) {
             Long id = idList.get(i);
             Map<String, Object> requestMap = new HashMap<>();

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

@@ -3,6 +3,7 @@ package cn.com.ctop.job.kuaishou.handler;
 import cn.com.ctop.kuaishou.modules.report.mapper.EtlKuaishouAccountMaterialReportDailyMapper;
 import cn.com.ctop.kuaishou.modules.report.service.IEtlKuaishouAccountMaterialReportDailyService;
 import cn.com.ctop.kuaishou.modules.report.service.IEtlKuaishouReportAccountDailyService;
+import cn.com.ctop.kuaishou.modules.report.service.IEtlKuaishouReportAccountHourlyService;
 import com.xxl.job.core.context.XxlJobHelper;
 import com.xxl.job.core.handler.annotation.XxlJob;
 import org.jeecg.common.util.DateUtils;
@@ -26,11 +27,13 @@ public class KuaishouDailyAccountReportLoadEtlJob {
     private IEtlKuaishouAccountMaterialReportDailyService etlKuaishouAccountMaterialReportDailyService;
     @Resource
     private EtlKuaishouAccountMaterialReportDailyMapper etlKuaishouAccountMaterialReportDailyMapper;
-
+    @Autowired
+    private IEtlKuaishouReportAccountHourlyService hourlyService;
     @XxlJob("kuaishouDailyAccountReportLoadEtl")
     public void execute() throws Exception {
         try {
             iEtlKuaishouReportAccountDailyService.queryEveryDayDataForAccount();
+            hourlyService.updateYesterdayEtlHourlyData();
             XxlJobHelper.log("queryEveryDayDataForAccount success");
         } catch (Exception e) {
             XxlJobHelper.log(e.getMessage());

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

@@ -25,7 +25,8 @@ public class KuaishouDailyAccountReportLoadJob {
     private ICtopOauthTokenService tokenService;
     @Autowired
     private IKuaishouInterfaceService kuaishouInterfaceService;
-    static ExecutorService executorService = Executors.newFixedThreadPool(3);
+    static ExecutorService executorService = Executors.newFixedThreadPool(10);
+    static ExecutorService adSceneExecutorService = Executors.newFixedThreadPool(10);
 
     @XxlJob("kuaishouDailyAccountReport")
     public void execute() throws Exception {
@@ -43,7 +44,6 @@ public class KuaishouDailyAccountReportLoadJob {
         }));
     }
 
-
     @XxlJob("kuaishouDailyAccountAdSceneReport")
     public void kuaishouDailyAccountAdSceneReport() throws Exception {
         Date getDate = DateUtils.addDay(new Date(), -1);
@@ -55,7 +55,7 @@ public class KuaishouDailyAccountReportLoadJob {
             XxlJobHelper.handleFail();
             return;
         }
-        tokens.forEach(token -> executorService.submit(() -> {
+        tokens.forEach(token -> adSceneExecutorService.submit(() -> {
             kuaishouInterfaceService.getAdvertiserReportDaily(token, getDate2, getDate, "adScene");
         }));
     }

+ 10 - 2
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouEtlVideoJob.java

@@ -2,6 +2,7 @@ package cn.com.ctop.job.kuaishou.handler;
 
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouVideoGetService;
 import cn.com.ctop.kuaishou.modules.material.service.IEtlKuaishouVideoInfoService;
+import cn.com.ctop.kuaishou.modules.report.service.IEtlKuaishouAccountMaterialReportDailyService;
 import cn.com.ctop.kuaishou.modules.report.service.IKuaishouVideoEtlInfoService;
 import com.xxl.job.core.handler.annotation.XxlJob;
 import org.jeecg.common.util.DateUtils;
@@ -17,9 +18,10 @@ public class KuaishouEtlVideoJob {
     @Autowired
     private IKuaiShouVideoGetService videoGetService;
     @Autowired
+    private IEtlKuaishouAccountMaterialReportDailyService materialReportDailyService;
+    @Autowired
     private IEtlKuaishouVideoInfoService videoEtlInfoService;
 
-
     @XxlJob("kuaishouEtlVideoJob")
     public void execute() throws Exception {
         Date startDate = DateUtils.addDay(new Date(), -2);
@@ -51,5 +53,11 @@ public class KuaishouEtlVideoJob {
             videoEtlInfoService.etlKuaishouVideoInfo(DateUtils.formatDate(DateUtils.addDay(startDate,i)));
         }
     }
-
+    @XxlJob("etlKuaishouAccountMaterialReportInfo")
+    public void etlKuaishouAccountMaterialReportInfo(){
+        Date startDate = new Date();
+        for(int i=1;i<=2;i++){
+            materialReportDailyService.etlKuaishouAccountMaterialReportInfo(DateUtils.formatDate(DateUtils.addDay(new Date(),-i)));
+        }
+    }
 }

+ 48 - 19
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouHourlyGroupReportLoadJob.java

@@ -1,16 +1,19 @@
 package cn.com.ctop.job.kuaishou.handler;
 
 import cn.com.ctop.common.module.entity.CtopOauthToken;
+import cn.com.ctop.common.module.entity.UserAllocation;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
-import com.xxl.job.core.context.XxlJobHelper;
+import cn.com.ctop.common.module.service.IUserAllocationService;
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.kuaishou.modules.report.entity.KuaiShouProjectData;
+import cn.com.ctop.kuaishou.modules.report.service.IKuaiShouProjectDataService;
+import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportHourlyGroupService;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.xxl.job.core.handler.annotation.XxlJob;
 import org.jeecg.common.util.DateUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
-import java.text.SimpleDateFormat;
-import java.util.Date;
 import java.util.List;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
@@ -24,26 +27,52 @@ import java.util.concurrent.Executors;
 public class KuaishouHourlyGroupReportLoadJob {
     @Autowired
     private ICtopOauthTokenService tokenService;
-    @Autowired
-    private IKuaishouInterfaceService kuaishouInterfaceService;
     static ExecutorService executorService = Executors.newFixedThreadPool(5);
+    @Autowired
+    private IKuaiShouProjectDataService kuaiShouProjectDataService;
+    @Autowired
+    private IUserAllocationService allocationService;
+    @Autowired
+    private IKuaishouReportHourlyGroupService hourlyGroupService;
+
 
     @XxlJob("kuaishouHourlyGroupReport")
     public void execute() throws Exception {
-        Date getDate = new Date();
-        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("HH");
-        String hour = simpleDateFormat.format(getDate);
-        if (null != hour && "00".equals(hour)) {
-            getDate = DateUtils.addDay(getDate, -1);
-        }
+        //增加接口的开始和结束日期
+        String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
+        String yesterday = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -1);
         //1:查询当日数据
-        List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
-        if (null == tokens || tokens.isEmpty()) {
-            XxlJobHelper.log("定时获取快手数据异常:未获取到可用的token");
-            XxlJobHelper.handleFail();
-            return ;
+        QueryWrapper<KuaiShouProjectData> queryWrapper = new QueryWrapper();
+        queryWrapper.eq("project_status", 0);
+        List<KuaiShouProjectData> list = kuaiShouProjectDataService.list(queryWrapper);
+        if (Check.isNull(list)) {
+            return;
+        }
+        for (KuaiShouProjectData projectData : list) {
+            Long projectId = projectData.getProjectId();
+            if (Check.isNull(projectId)) {
+                continue;
+            }
+            QueryWrapper<UserAllocation> allocationQueryWrapper = new QueryWrapper<>();
+            allocationQueryWrapper.eq("project_id", projectId);
+            allocationQueryWrapper.eq("account_status", 0);
+            List<UserAllocation> accountIds = allocationService.list(allocationQueryWrapper);
+            if (Check.isNull(accountIds)) {
+                continue;
+            }
+            for (UserAllocation allocation : accountIds) {
+                CtopOauthToken token = tokenService.getTokenByAccountId(allocation.getAccountId());
+                if (Check.isNull(token)) {
+                    continue;
+                }
+
+                executorService.submit(new Runnable() {
+                    @Override
+                    public void run() {
+                        hourlyGroupService.getAdvertiserGroupReportHourly(token.getAccountId(), token.getAccessToken(), yesterday, yesterday);
+                    }
+                });
+            }
         }
-        Date finalGetDate = getDate;
-        tokens.forEach(token -> executorService.submit(() -> kuaishouInterfaceService.getAdvertiserGroupReportHourly(token, finalGetDate, finalGetDate)));
     }
 }

+ 66 - 2
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouMatDailyReportJob.java

@@ -1,8 +1,14 @@
 package cn.com.ctop.job.kuaishou.handler;
 
 import cn.com.ctop.common.module.entity.CtopOauthToken;
+import cn.com.ctop.common.module.entity.UserAllocation;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
+import cn.com.ctop.common.module.service.IUserAllocationService;
+import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouReportDailyMaterialService;
+import cn.com.ctop.kuaishou.modules.report.entity.KuaiShouProjectData;
+import cn.com.ctop.kuaishou.modules.report.service.IKuaiShouProjectDataService;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.xxl.job.core.context.XxlJobHelper;
 import com.xxl.job.core.handler.annotation.XxlJob;
 import org.jeecg.common.util.DateUtils;
@@ -19,20 +25,78 @@ public class KuaishouMatDailyReportJob {
     private ICtopOauthTokenService tokenService;
     @Autowired
     private IKuaiShouReportDailyMaterialService kuaiShouReportDailyMaterialService;
+    @Autowired
+    private IKuaiShouProjectDataService kuaiShouProjectDataService;
+    @Autowired
+    private IUserAllocationService allocationService;
+
     static ExecutorService executorService = Executors.newFixedThreadPool(10);
+    static ExecutorService hourExecutorService = Executors.newFixedThreadPool(5);
 
+    /**
+     * 素材日报
+     *
+     * @throws Exception
+     */
     @XxlJob("kuaishouMaterialReportByStateDate")
     public void execute() throws Exception {
         //增加接口的开始和结束日期
         String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
-        String endDate =DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -1);
+        String endDate = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -1);
         String startDate = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -2);
         //1:查询当日数据
         List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
         tokens.forEach(token -> executorService.submit(() -> {
-            kuaiShouReportDailyMaterialService.getMaterialReportByAccountIdAndStatDate(token.getAccountId(),token.getAccessToken(),startDate,endDate,1);
+            kuaiShouReportDailyMaterialService.getMaterialReportByAccountIdAndStatDate(token.getAccountId(), token.getAccessToken(), startDate, endDate, "DAILY", 1);
         }));
         XxlJobHelper.log("快手物料数据同步完成");
     }
 
+
+    /**
+     * 素材时报
+     *
+     * @throws Exception
+     */
+    @XxlJob("kuaishouMaterialHourReportByStateDate")
+    public void kuaishouMaterialHourReportByStateDate() throws Exception {
+        //增加接口的开始和结束日期
+        String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
+        String yesterday = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -1);
+        //1:查询当日数据
+        QueryWrapper<KuaiShouProjectData> queryWrapper = new QueryWrapper();
+        queryWrapper.eq("project_status", 0);
+        List<KuaiShouProjectData> list = kuaiShouProjectDataService.list(queryWrapper);
+        if (Check.isNull(list)) {
+            return;
+        }
+
+        for (KuaiShouProjectData projectData : list) {
+            Long projectId = projectData.getProjectId();
+            if (Check.isNull(projectId)) {
+                continue;
+            }
+            QueryWrapper<UserAllocation> allocationQueryWrapper = new QueryWrapper<>();
+            allocationQueryWrapper.eq("project_id", projectId);
+            allocationQueryWrapper.eq("account_status", 0);
+            List<UserAllocation> accountIds = allocationService.list(allocationQueryWrapper);
+            if (Check.isNull(accountIds)) {
+                continue;
+            }
+            for (UserAllocation allocation : accountIds) {
+                CtopOauthToken token = tokenService.getTokenByAccountId(allocation.getAccountId());
+                if (Check.isNull(token)) {
+                    continue;
+                }
+
+                hourExecutorService.submit(new Runnable() {
+                    @Override
+                    public void run() {
+                        kuaiShouReportDailyMaterialService.getMaterialReportByAccountIdAndStatDate(token.getAccountId(), token.getAccessToken(), yesterday, yesterday, "HOURLY", 1);
+                    }
+                });
+            }
+        }
+    }
+
 }

+ 5 - 0
module-job-kuaishou/src/main/resources/application-dev.yml

@@ -183,6 +183,7 @@ bytedance:
     ad-report-get: /2/report/ad/get/
     ad-creative-get: /2/report/creative/get/
     advertiser-fund-daily-stat: /2/advertiser/fund/daily_stat/
+
 xxl:
   job:
     accessToken:
@@ -194,4 +195,8 @@ xxl:
       logretentiondays: 30
     admin:
       addresses: 127.0.0.1:8090/xxl-job-admin/
+xxl-job:
+  requestUrl: http://localhost:8080
+
+
 

+ 7 - 0
module-job-kuaishou/src/main/resources/application-jiaoyang.yml

@@ -232,3 +232,10 @@ ai:
   callback:
     callback-unit-url: http://192.168.1.193:31012/ai_callback_add_group
     callback-creative-url: http://192.168.1.193:31012/ai_callback_add_creative
+zip:
+  local:
+    download-path: /data/unzip/
+xxl-job:
+    requestUrl: http://jiaoyangapi.shyouteng.com.cn
+
+

+ 239 - 0
module-job-kuaishou/src/main/resources/application-preprod.yml

@@ -0,0 +1,239 @@
+management:
+  endpoints:
+    web:
+      exposure:
+        include: metrics,httptrace
+spring:
+  servlet:
+    multipart:
+      max-file-size: -1
+      max-request-size: -1
+  mail:
+    host: smtp.163.com
+    username: jeecgos@163.com
+    password: ??
+    properties:
+      mail:
+        smtp:
+          auth: true
+          starttls:
+            enable: true
+            required: true
+  #json 时间戳统一转换
+  jackson:
+    date-format:   yyyy-MM-dd HH:mm:ss
+    time-zone:   GMT+8
+  aop:
+    proxy-target-class: true
+  #配置freemarker
+  freemarker:
+    # 设置模板后缀名
+    suffix: .ftl
+    # 设置文档类型
+    content-type: text/html
+    # 设置页面编码格式
+    charset: UTF-8
+    # 设置页面缓存
+    cache: false
+    prefer-file-system-access: false
+    # 设置ftl文件路径
+    template-loader-path:
+      - classpath:/templates
+  # 设置静态文件路径,js,css等
+  mvc:
+    static-path-pattern: /**
+  resource:
+    static-locations: classpath:/static/,classpath:/public/
+  autoconfigure:
+    exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
+  datasource:
+    url: jdbc:mysql://172.30.0.4:4000/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
+    username: hcst
+    password: hcst@2020
+    driver-class-name: com.mysql.jdbc.Driver
+    druid:
+      stat-view-servlet:
+        loginUsername: admin
+        loginPassword: hcst2016
+        enabled: true
+      web-stat-filter:
+        enabled: true
+    #      remove-abandoned: false
+    dynamic:
+      druid: # 全局druid参数,绝大部分值和默认保持一致。(现已支持的参数如下,不清楚含义不要乱设置)
+        # 连接池的配置信息
+        # 初始化大小,最小,最大
+        connection-init-sql: set names utf8mb4
+        initial-size: 5
+        min-idle: 5
+        maxActive: 20
+        # 配置获取连接等待超时的时间
+        maxWait: 60000
+        # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
+        timeBetweenEvictionRunsMillis: 60000
+        # 配置一个连接在池中最小生存的时间,单位是毫秒
+        minEvictableIdleTimeMillis: 300000
+        validationQuery: SELECT 1 FROM DUAL
+        testWhileIdle: true
+        testOnBorrow: false
+        testOnReturn: false
+        # 打开PSCache,并且指定每个连接上PSCache的大小
+        poolPreparedStatements: true
+        maxPoolPreparedStatementPerConnectionSize: 20
+        # 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙
+        filters: stat,slf4j
+        # 通过connectProperties属性来打开mergeSql功能;慢SQL记录
+        connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
+      datasource:
+        master:
+          url: jdbc:mysql://172.30.0.4:4000/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
+          username: hcst
+          password: hcst@2020
+          driver-class-name: com.mysql.jdbc.Driver
+  #redis 配置
+  redis:
+    database: 0
+    host: 172.30.0.17
+#    host: 127.0.0.1
+    lettuce:
+      pool:
+        max-active: 8   #最大连接数据库连接数,设 0 为没有限制
+        max-idle: 8     #最大等待连接中的数量,设 0 为没有限制
+        max-wait: -1ms  #最大建立连接等待时间。如果超过此时间将接到异常。设为-1表示无限制。
+        min-idle: 0     #最小等待连接中的数量,设 0 为没有限制
+      shutdown-timeout: 100ms
+    password: foobared
+    port: 6379
+#mybatis plus 设置
+mybatis-plus:
+  mapper-locations: classpath*:org/jeecg/modules/**/xml/*Mapper.xml,classpath*:cn/com/ctop/**/xml/*Mapper.xml
+  global-config:
+    # 关闭MP3.0自带的banner
+    banner: false
+    db-config:
+      #主键类型  0:"数据库ID自增",1:"该类型为未设置主键类型", 2:"用户输入ID",3:"全局唯一ID (数字类型唯一ID)", 4:"全局唯一ID UUID",5:"字符串全局唯一ID (idWorker 的字符串表示)";
+      id-type: 4
+      # 默认数据库表下划线命名
+      table-underline: true
+#jeecg专用配置
+jeecg:
+  elasticsearch:
+    cluster-nodes:
+    check-enabled: false
+  uploadType:
+  oss:
+    endpoint:
+    accessKey:
+    secretKey:
+    bucketName:
+    staticDomain:
+  sms:
+    accessKeyId:
+    accessKeySecret:
+  minio:
+    minio_url:
+    minio_name:
+    minio_pass:
+    bucketName:
+  ffmpeg:
+    bin: ffmpeg
+  path:
+    #文件上传根目录 设置
+    upload: /data/upload
+    #webapp文件路径
+    webapp: /data/webapp
+    video-upload: /data/upload/video/
+    image-upload: /data/upload/image/
+    chrome-driver: /usr/bin/chromedriver
+    csv-upload: /data/upload/csv/
+    bak-database-file: /data/data/bak/
+    report-history: /data/upload/report/history/
+    report-daily: /data/upload/report/daily/
+    kuaishou-agent-image: /data/upload/image/temp.png
+    kuaishou-account-captcha-image: /data/upload/image/captcha.png
+kuaishou:
+  api-url: https://ad.e.kuaishou.com
+  auth-url: https://ad.e.kuaishou.com
+  appid: 27
+  third-appid: 328
+  oauth-type: agent
+  secret: QovprB1tNhXptgDc
+  third-secret: 1iFTBiMdohkyEQQs
+  callback-url: http://adsp.c-top.com.cn:8080/jeecg-boot/kuaishou
+  third-callback-url: http://callback.shyouteng.com.cn/kuaishou
+  apk-sava-path: /mnt/file/apk
+  image-sava-path: /mnt/file/image
+  video-sava-path: /mnt/file/video
+  model-video-src-path: /mnt/data/src/
+  model-video-fill-path: /mnt/data/fill/
+  model-video-final-path: /mnt/data/final/
+  group-control:
+    path: http://39.106.184.70
+    port: 4723
+logging:
+  level:
+    root: info
+  config: classpath:logback-prod.xml
+chrome:
+  script:
+    clean: sh /data/webapp/cleanProcess.sh
+oss:
+  replace:
+    replace-value: oss-cn-beijing-internal
+    replace-old-value: oss-cn-beijing
+    download: /data/file/video/
+bytedance:
+  appId: 1635316529903624
+  secret: 0c51523e90d6166418fc8421a4896808e90e26f4
+  url:
+    auth-prefix: https://ad.oceanengine.com/openapi
+    api-prefix: https://ad.oceanengine.com/open_api
+    callback-url: http://adsp.c-top.com.cn:8080/jeecg-boot/bytedance
+    refresh-token: /oauth2/refresh_token
+    advertiser-info: /2/advertiser/public_info/
+    ad-get: /2/ad/get/
+    ad-create: /2/ad/create/
+    ad-update: /2/ad/update/
+    ad-update-status: /2/ad/update/status/
+    ad-update-bid: /2/ad/update/bid/
+    ad-update-budget: /2/ad/update/budget/
+    ad-update-reject-reason: 2/ad/reject_reason/
+    campaign-get: /2/campaign/get/
+    campaign-create: /2/campaign/create/
+    campaign-update-status: /2/campaign/update/status/
+    campaign-update: /2/campaign/update/
+    dmp-custom-audience-select: /2/dmp/custom_audience/select/
+    file-video-ad: /2/file/video/ad/
+    file-image-ad: /2/file/image/ad/
+    creative-update-status: /2/creative/update/status/
+    creative-material-get: /2/creative/material/read/
+    creative-create-v2: /2/creative/create_v2/
+    creative-get: /2/creative/get/
+    creative-read: /2/creative/read_v2/
+    creative-update: /2/creative/update_v2/
+    creative-reject-reason: /2/creative/reject_reason/
+    advertiser-report-get: /2/report/advertiser/get/
+    campaign-report-get: /2/report/campaign/get/
+    ad-report-get: /2/report/ad/get/
+    ad-creative-get: /2/report/creative/get/
+    advertiser-fund-daily-stat: /2/advertiser/fund/daily_stat/
+xxl:
+  job:
+    accessToken:
+    executor:
+      appname: module-job-kuaishou
+      port: 9998
+      ip:
+      logpath: /data/applogs/xxl-job/jobhandler
+      logretentiondays: 30
+    admin:
+      addresses: http://139.186.29.76:8090/xxl-job-admin
+ai:
+  callback:
+    callback-unit-url: http://192.168.1.193:31012/ai_callback_add_group
+    callback-creative-url: http://192.168.1.193:31012/ai_callback_add_creative
+zip:
+  local:
+    download-path: /data/unzip/
+xxl-job:
+  requestUrl: http://api.tjyourong.com.cn

+ 3 - 1
module-job-kuaishou/src/main/resources/application-prod.yml

@@ -234,4 +234,6 @@ ai:
     callback-creative-url: http://192.168.1.193:31012/ai_callback_add_creative
 zip:
   local:
-    download-path: /data/unzip/
+    download-path: /data/unzip/
+xxl-job:
+  requestUrl: http://api.tjyourong.com.cn

+ 4 - 0
module-job-kuaishou/src/main/resources/application-test.yml

@@ -212,3 +212,7 @@ xxl:
       logretentiondays: 30
     admin:
       addresses: http://127.0.0.1:8090/xxl-job-admin
+xxl-job:
+  requestUrl:
+
+

+ 18 - 10
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/controller/AiKuaishouCreateCreativeController.java

@@ -82,13 +82,17 @@ public class AiKuaishouCreateCreativeController {
             if (Check.isNull(hour)) {
                 throw new Exception("小时数据为空");
             }
-            kuaishouCustomCreativeSupplementExecutorService.submit(() -> {
-                try {
-                    createCreativeService.customCreativeSupplement(strategy, hour);
-                } catch (ParseException e) {
-                    e.printStackTrace();
-                }
-            });
+            if (strategy.getHistoryTop() == 0) {
+                kuaishouCustomCreativeSupplementExecutorService.submit(() -> {
+                    try {
+                        createCreativeService.customCreativeSupplement(strategy, hour);
+                    } catch (ParseException e) {
+                        e.printStackTrace();
+                    }
+                });
+            } else {
+                log.info("高质量暂停搭建,accountId:{}", strategy.getAccountId());
+            }
             returnJson.put("code", 0);
             returnJson.put("message", "异步创建中");
         } catch (Exception e) {
@@ -155,9 +159,13 @@ public class AiKuaishouCreateCreativeController {
             if (Check.isNull(videoCnt)) {
                 throw new Exception("视频数量不能为空");
             }
-            kuaishouProgramTopCreativeAutoService.submit(() -> {
-                createCreativeService.autoCreateProgramCreative(strategy, 2, videoCnt);
-            });
+            if (strategy.getHistoryTop() == 0) {
+                kuaishouProgramTopCreativeAutoService.submit(() -> {
+                    createCreativeService.autoCreateProgramCreative(strategy, 2, videoCnt);
+                });
+            } else {
+                log.info("历史高质量暂停搭建,accountId:{}", strategy.getAccountId());
+            }
             returnJson.put("code", 0);
             returnJson.put("message", "异步创建中");
         } catch (Exception e) {

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

@@ -375,6 +375,7 @@ public class AiKuaishouAdvertiserStrategy {
     private Long customUnitCnt;
     private Long programUnitCnt;
     private String materialKeyword;
+    private Integer historyTop;
 
     @TableField(exist = false)
     private String authName;

+ 241 - 157
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/AiKuaishouCreateCreativeServiceImpl.java

@@ -8,47 +8,26 @@ import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.HttpUtils;
 import cn.com.ctop.common.module.utils.KuaishouInterfaceConstant;
 import cn.com.ctop.common.module.utils.PropertiesUtils;
-import cn.com.ctop.kuaishou.modules.ai.entity.AiKuaiShouAppInfo;
-import cn.com.ctop.kuaishou.modules.ai.entity.AiKuaishouAdvertiserStrategy;
-import cn.com.ctop.kuaishou.modules.ai.entity.AiKuaishouCampaignLevelOperationRecord;
-import cn.com.ctop.kuaishou.modules.ai.entity.AiKuaishouCreativeLevelOperationRecord;
-import cn.com.ctop.kuaishou.modules.ai.entity.AiKuaishouUnitLevelOperationRecord;
-import cn.com.ctop.kuaishou.modules.ai.entity.KuaishouAccountCreativeOverrunInfo;
+import cn.com.ctop.kuaishou.modules.ai.entity.*;
 import cn.com.ctop.kuaishou.modules.ai.enums.KuaishouCreativeAdsenceTypeEnum;
 import cn.com.ctop.kuaishou.modules.ai.enums.KuaishouCreativeMatTypeEnum;
-import cn.com.ctop.kuaishou.modules.ai.service.IAiKuaiShouAppInfoService;
-import cn.com.ctop.kuaishou.modules.ai.service.IAiKuaishouCampaignLevelOperationRecordService;
-import cn.com.ctop.kuaishou.modules.ai.service.IAiKuaishouCreateCreativeService;
-import cn.com.ctop.kuaishou.modules.ai.service.IAiKuaishouCreativeLevelOperationRecordService;
-import cn.com.ctop.kuaishou.modules.ai.service.IAiKuaishouUnitLevelOperationRecordService;
-import cn.com.ctop.kuaishou.modules.ai.service.IKuaishouAccountCreativeOverrunInfoService;
-import cn.com.ctop.kuaishou.modules.ai.service.IKuaishouLandpagePackageService;
+import cn.com.ctop.kuaishou.modules.ai.service.*;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouImageGet;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouVideoGet;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouCampaignService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouGroupService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouGroupTemplateService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouImageGetService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouMaterialUploadService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouVideoGetService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
+import cn.com.ctop.kuaishou.modules.batch.service.*;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.google.common.collect.Lists;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.util.DateUtils;
+import org.jeecg.common.util.RedisUtil;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.text.ParseException;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
+import java.util.*;
 
 @Slf4j
 @Service
@@ -79,8 +58,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
     private IAiKuaishouUnitLevelOperationRecordService unitLevelOperationRecordService;
     @Autowired
     private IAiKuaishouCreativeLevelOperationRecordService creativeLevelOperationRecordService;
-    @Autowired
-    private IKuaishouLandpagePackageService landpagePackageService;
+
 
     /**
      * 创建自定义创意
@@ -121,6 +99,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
                         log.info("账户:{},appid({}) 数据不存在", accountId, appIdArray.getLong(i));
                         continue;
                     }
+
                     if (null != strategy.getGeneralTrack() && strategy.getGeneralTrack() == 0) {
                         strategy.setClickTrackUrl(appInfo.getTrackUrl());
                         strategy.setImpressionUrl(appInfo.getTrackUrl());
@@ -148,8 +127,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
                         }
                         unitCnt++;
                         //开始创建组+创意
-                        String timestamp = DateUtils.formatDate(new Date(), "yyyyMMddHHmmss");
-                        String unitName = getName(strategy.getGroupName(), strategy, createType, appInfo, timestamp, unitCnt);
+                        String unitName = getName(strategy.getGroupName(), strategy, createType, appInfo, videoItem.getPhotoName(), "unit", newCampaignId);
                         JSONObject unitParams = createUnitParams(token, newCampaignId, strategy, unitName, appInfo.getAppId());
                         Map<String, Object> unitCreateResult = kuaishouInterfaceService.adUnitCreate(token.getAccessToken(), token.getAccountId(), unitParams, 1);
                         Integer unitCode = (Integer) unitCreateResult.get("code");
@@ -206,9 +184,13 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
                     continue;
                 }
                 unitCnt++;
-                String timestamp = DateUtils.formatDate(new Date(), "yyyyMMddHHmmss");
-                String unitName = getName(strategy.getGroupName(), strategy, createType, null, timestamp, unitCnt);
-                Long appId = JSONArray.parseArray(strategy.getAppIdArray()).getLong(0);
+                String unitName = getName(strategy.getGroupName(), strategy, createType, null, videoItem.getPhotoName(), "unit", newCampaignId);
+
+                Long appId = null;
+                if (strategy.getCampaignType() == 2 || strategy.getCampaignType() == 7) {
+                    appId = JSONArray.parseArray(strategy.getAppIdArray()).getLong(0);
+                }
+
                 JSONObject unitParams = createUnitParams(token, newCampaignId, strategy, unitName, appId);
                 Map<String, Object> unitCreateResult = kuaishouInterfaceService.adUnitCreate(token.getAccessToken(), token.getAccountId(), unitParams, 1);
                 Integer unitCode = (Integer) unitCreateResult.get("code");
@@ -216,6 +198,12 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
                 AiKuaishouUnitLevelOperationRecord unitLevelOperationRecord = new AiKuaishouUnitLevelOperationRecord();
                 BeanUtils.copyProperties(strategy, unitLevelOperationRecord);
                 unitLevelOperationRecord.setGroupName(unitName);
+                if (!Check.isNull(strategy.getCpaBid())) {
+                    unitLevelOperationRecord.setCpaBid(Integer.valueOf(strategy.getCpaBid() + ""));
+                }
+                if (!Check.isNull(strategy.getBid())) {
+                    unitLevelOperationRecord.setBid(Integer.valueOf(strategy.getBid() + ""));
+                }
                 unitLevelOperationRecord.setCreateTime(new Date());
                 unitLevelOperationRecord.setStatus(unitCode);
                 unitLevelOperationRecord.setMessage(unitMessage);
@@ -275,6 +263,9 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
         String startTime = DateUtils.formatDateTime(now + timeStart * 60 * 1000L);
         String endTime = DateUtils.formatDateTime(now + timeEnd * 60 * 1000L);
 
+        String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
+        String key = token.getAccountId() + "_ProgramCreative" + "_" + nowDate;
+
 
         if (null != singleAppid && singleAppid == 0) {
             //多应用
@@ -310,9 +301,18 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
                     //创建组+创意
                     List<List<KuaiShouVideoGet>> splitVideos = Lists.partition(allVideos, 5);
                     for (int j = 1; j < splitVideos.size() + 1; j++) {
+
+                        Object redisObj = redisUtil.get(key);
+                        if (!Check.isNull(redisObj)) {
+                            Integer value = (Integer) redisObj;
+                            if (value == 1) {
+                                log.error("程序化创意创建超限,accountId:{}", strategy.getAccountId());
+                                return;
+                            }
+                        }
+
                         //创建组
-                        String timestamp = DateUtils.formatDate(new Date(), "yyyyMMddHHmmss");
-                        String unitName = getName(strategy.getGroupName(), strategy, createType, appInfo, timestamp, null);
+                        String unitName = getName(strategy.getGroupName(), strategy, createType, appInfo, null, "unit", newCampaignId);
                         JSONObject unitParams = createUnitParams(token, newCampaignId, strategy, unitName, appInfo.getAppId());
                         Map<String, Object> unitCreateResult = kuaishouInterfaceService.adUnitCreate(token.getAccessToken(), token.getAccountId(), unitParams, 1);
                         Integer unitCode = (Integer) unitCreateResult.get("code");
@@ -350,17 +350,25 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
             if (null == newCampaignId) {
                 return;
             }
-
             //创意
             List<List<KuaiShouVideoGet>> splitVideos = Lists.partition(allVideos, 5);
             for (int j = 1; j < splitVideos.size() + 1; j++) {
+                Object redisObj = redisUtil.get(key);
+                if (!Check.isNull(redisObj)) {
+                    Integer value = (Integer) redisObj;
+                    if (value == 1) {
+                        log.error("程序化创意创建超限,accountId:{}", strategy.getAccountId());
+                        return;
+                    }
+                }
                 //创建组
-                String timestamp = DateUtils.formatDate(new Date(), "yyyyMMddHHmmss");
-                String unitName = getName(strategy.getGroupName(), strategy, createType, null, timestamp, null);
+                String unitName = getName(strategy.getGroupName(), strategy, createType, null, null, "unit", newCampaignId);
                 String appIdString = strategy.getAppIdArray();
                 Long appId = null;
-                if (!Check.isNull(appIdString) && !Check.isNull(JSON.parseArray(appIdString))) {
-                    appId = JSON.parseArray(appIdString).getLong(0);
+                if (strategy.getCampaignType() == 2 || strategy.getCampaignType() == 7) {
+                    if (!Check.isNull(appIdString) && !Check.isNull(JSON.parseArray(appIdString))) {
+                        appId = JSON.parseArray(appIdString).getLong(0);
+                    }
                 }
                 JSONObject unitParams = createUnitParams(token, newCampaignId, strategy, unitName, appId);
                 Map<String, Object> unitCreateResult = kuaishouInterfaceService.adUnitCreate(token.getAccessToken(), token.getAccountId(), unitParams, 1);
@@ -390,7 +398,6 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
 
     @Override
     public void customCreativeSupplement(AiKuaishouAdvertiserStrategy strategy, Integer hour) throws ParseException {
-
         Long customUnitCnt = strategy.getCustomUnitCnt();
         if (Check.isNull(customUnitCnt)) {
             Integer imageCnt = strategy.getImageCnt();
@@ -399,7 +406,6 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
             } else {
                 customUnitCnt = 2000L / imageCnt;
             }
-
         }
 
         Long unitNum = customUnitCnt * hour / 20;
@@ -447,6 +453,8 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
         }
     }
 
+    @Autowired
+    private IKuaiShouUpdateService updateService;
 
     private void createProgramCreative(CtopOauthToken token, JSONObject creativeParams, AiKuaishouAdvertiserStrategy strategy) {
         Map<String, String> headers = new HashMap<>();
@@ -461,26 +469,26 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
             return;
         }
         Integer code = resultJson.getInteger("code");
+
+
         String message = resultJson.getString("message");
-        if (null == code || code != 0) {
-            log.error("创建程序化创意失败,accountId:{},返回结果:{},入参:{}", token.getAccountId(), message, creativeParams);
-            return;
-        }
-        log.info("创建程序化创意成功");
-        createLandPageAndUnit(creativeParams, resultJson.getJSONObject("data"));
-    }
 
-    //绑定落地页与广告组、创意的关系
-    private void createLandPageAndUnit(JSONObject programJson, JSONObject data) {
-        if (!Check.isNull(data) && !Check.isNull(programJson.getLong("site_id"))) {
-            Thread thread = new Thread() {
-                @Override
-                public void run() {
-                    landpagePackageService.createLandPageAndUnit(programJson.getLong("site_id"), data.getLong("creative_id"), programJson.getLong("unit_id"), programJson.getLong("advertiser_id"));
-                }
-            };
-            thread.start();
+        Long unitId = creativeParams.getLong("unit_id");
+        if (code == 0) {
+            log.info("创建程序化创意成功,accountId:{},unit:{}", token.getAccountId(), unitId);
+
+        } else {
+            log.error("快手创建程序化创意失败,accountId:{},unitId:{},返回信息:{}", token.getAccountId(), unitId, message);
+            if (code == 400001 && "/rest/openapi/v2/creative/advanced/program/create调用已超日限,次日可恢复调用".equals(message)) {
+                String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
+                String key = token.getAccountId() + "_ProgramCreative" + "_" + nowDate;
+                redisUtil.set(key, 1, 100000L);
+                updateService.updateUnitStatus(token.getAccessToken(), token.getAccountId(), unitId, 3, "e9ca23d68d884d4ebb19d07889727dae");
+            }
+
+
         }
+
     }
 
     private JSONObject programCreativeParams(CtopOauthToken token, Long unitId, List<KuaiShouVideoGet> list, AiKuaishouAdvertiserStrategy strategy, Integer creativeCnt, String appVersion) {
@@ -643,24 +651,8 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
         }
     }
 
+
     private Long getCampaignId(AiKuaishouAdvertiserStrategy strategy, CtopOauthToken token, String replaceString, String checkType, Integer createType, AiKuaiShouAppInfo appInfo, String uuid) {
-        //  JSONArray campaignList;
-        String timestamp = DateUtils.formatDate(new Date(), "yyyyMMddHHmmss");
-        /*if ("ALL_CAMPAIGN".equals(checkType)) {
-            campaignList = kuaishouInterfaceService.getCampaignList(token, null, null, 1);
-        } else {
-            timestamp = DateUtils.formatDate(new Date(), "yyyyMMddHHmmss");
-            campaignList = kuaishouInterfaceService.getCampaignList(token, new Date(), new Date(), 1);
-        }*/
-
-       /* if (!Check.isNull(campaignList)){
-            for (int i = 0; i < campaignList.size(); i++) {
-                JSONObject jsonObject = campaignList.getJSONObject(i);
-                if (jsonObject.getString("campaign_name").contains(replaceString)) {
-                    return jsonObject.getLong("campaign_id");
-                }
-            }
-        }*/
         Long campaignId = null;
         if ("ALL_CAMPAIGN".equals(checkType)) {
             campaignId = campaignService.getCampaignIdByAccountAndName(strategy.getAccountId(), replaceString);
@@ -675,7 +667,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
         // 不存在“上新”计划,则创建一个计划
         JSONObject campaignParams = new JSONObject();
         campaignParams.put("advertiser_id", token.getAccountId());
-        String campaignName = getName(strategy.getCampaignName(), strategy, createType, appInfo, timestamp, null);
+        String campaignName = getName(strategy.getCampaignName(), strategy, createType, appInfo, null, "plan", null);
         campaignParams.put("campaign_name", campaignName);
         campaignParams.put("type", strategy.getCampaignType());
         if (null != strategy.getCampaignDayBudget() && strategy.getCampaignDayBudget() != 0) {
@@ -711,10 +703,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
         unitParams.put("unit_name", unitName);
         //出价类型
         unitParams.put("bid_type", strategy.getBidType());
-        // 优先从系统应用商店下载
-        if (null != strategy.getUseAppMarket()) {
-            unitParams.put("use_app_market", strategy.getUseAppMarket());
-        }
+
         //组单日预算
         if (null != strategy.getUnitDayBudget() && strategy.getUnitDayBudget() != 0) {
             unitParams.put("day_budget", strategy.getUnitDayBudget());
@@ -722,11 +711,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
             unitParams.put("day_budget", 0);
         }
         //应用商店列表
-        if (null != strategy.getAppStore() && !"".equals(strategy.getAppStore())) {
-            unitParams.put("app_store", JSON.parseArray(strategy.getAppStore()));
-        }
         unitParams.put("ocpx_action_type", strategy.getOcpxActionType());
-
         //出价
         if (null != strategy.getBid() && strategy.getBid() != 0) {
             unitParams.put("bid", strategy.getBid());
@@ -754,21 +739,63 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
         if (!Check.isNull(strategy.getDeepConversionBid())) {
             unitParams.put("deep_conversion_bid", strategy.getDeepConversionBid());
         }
-
         Integer sceneId = null;
         String scenceIdString = strategy.getSceneId();
 
         if (!Check.isNull(scenceIdString) && !Check.isNull(JSON.parseArray(scenceIdString))) {
             JSONArray scenceArray = JSON.parseArray(scenceIdString);
             sceneId = scenceArray.getInteger(0);
-            //资源位置
-           /* if (unitType == 7) {
-                //程序化
-                scenceArray = cleanPramgramErrorScence(scenceArray);
-            }*/
             unitParams.put("scene_id", scenceArray);
         }
+        Integer campaignType = strategy.getCampaignType();
+        if (campaignType == 2) { // 提升应用安装
+            //应用ID
+            if (!Check.isNull(appId)) {
+                unitParams.put("app_id", appId);
+            }
+            // 直达链接
+            if (!Check.isNull(strategy.getSchemaUri())) {
+                unitParams.put("schema_uri", strategy.getSchemaUri());
+            }
+            // 优先从系统应用商店下载
+            if (null != strategy.getUseAppMarket()) {
+                unitParams.put("use_app_market", strategy.getUseAppMarket());
+            }
+            if (null != strategy.getAppStore() && !"".equals(strategy.getAppStore())) {
+                unitParams.put("app_store", JSON.parseArray(strategy.getAppStore()));
+            }
+        } else if (campaignType == 3) { //  获取电商下单
+            //url类型
+            if (!Check.isNull(strategy.getUrlType())) {
+                unitParams.put("url_type", strategy.getUrlType());
+            }
+            if (!Check.isNull(strategy.getUrl())) {
+                unitParams.put("url", strategy.getUrl());
+            }
+        } else if (campaignType == 5) { //收集销售线索
+            //url类型
+            if (!Check.isNull(strategy.getWebUriType())) {
+                unitParams.put("web_uri_type", strategy.getWebUriType());
+            }
+            //url
+            if (!Check.isNull(strategy.getUrl())) {
+                unitParams.put("url", strategy.getUrl());
+            }
+        } else if (campaignType == 7) { //  提高应用活跃
+            //  appId
+            if (!Check.isNull(appId)) {
+                unitParams.put("app_id", appId);
+            }
 
+            //  url
+            if (!Check.isNull(strategy.getUrl())) {
+                unitParams.put("url", strategy.getUrl());
+            }
+            //调起链接
+            if (!Check.isNull(strategy.getSchemaUri())) {
+                unitParams.put("schema_uri", strategy.getSchemaUri());
+            }
+        }
         //投放开始时间
         if (!Check.isNull(strategy.getBeginTime())) {
             unitParams.put("begin_time", strategy.getBeginTime());
@@ -787,26 +814,6 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
         if (!Check.isNull(strategy.getConvertId())) {
             unitParams.put("convert_id", strategy.getConvertId());
         }
-        //url类型
-        if (!Check.isNull(strategy.getUrlType())) {
-            unitParams.put("url_type", strategy.getUrlType());
-        }
-        //url类型
-        if (!Check.isNull(strategy.getWebUriType())) {
-            unitParams.put("web_uri_type", strategy.getWebUriType());
-        }
-        //url
-        if (!Check.isNull(strategy.getUrl())) {
-            unitParams.put("url", strategy.getUrl());
-        }
-        //调起链接
-        if (!Check.isNull(strategy.getSchemaUri())) {
-            unitParams.put("schema_uri", strategy.getSchemaUri());
-        }
-        //应用ID
-        if (!Check.isNull(appId)) {
-            unitParams.put("app_id", appId);
-        }
         //创意展现方式
         if (!Check.isNull(strategy.getShowMode())) {
             unitParams.put("show_mode", strategy.getShowMode());
@@ -827,7 +834,6 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
         if (!Check.isNull(strategy.getAutoCreatePhoto())) {
             unitParams.put("auto_create_photo", strategy.getAutoCreatePhoto());
         }
-
         if (unitType == 7) {
             //是否开启智能抽帧
             if (!Check.isNull(strategy.getSmartCover())) {
@@ -857,8 +863,6 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
             // 定向数据
             unitParams.put("target", target);
         }
-
-
         // 设置定向内容
         JSONObject targetJsonObject = new JSONObject();
         if (null != strategy.getRegion() && !"".equals(strategy.getRegion())) {
@@ -888,31 +892,53 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
         if (null != strategy.getDevicePrice() && !"".equals(strategy.getDevicePrice()) && !"[]".equals(strategy.getDevicePrice())) {
             targetJsonObject.put("device_price", JSON.parseArray(strategy.getDevicePrice()));
         }
-        if (null != strategy.getPopulation() && !"".equals(strategy.getPopulation())) {
-            JSONArray population = JSON.parseArray(strategy.getPopulation());
-            targetJsonObject.put("population", population);
+        if (sceneId != 5) {
+            if (null != strategy.getFilterConvertedLevel() && strategy.getFilterConvertedLevel() != 0) {
+                targetJsonObject.put("filter_converted_level", strategy.getFilterConvertedLevel());
+            }
         }
-        if (null != strategy.getFilterConvertedLevel() && strategy.getFilterConvertedLevel() != 0) {
-            targetJsonObject.put("filter_converted_level", strategy.getFilterConvertedLevel());
+
+        JSONArray appInterest = JSONArray.parseArray(strategy.getAppInterest());
+        if (!Check.isNull(appInterest)) {
+            targetJsonObject.put("app_interest", appInterest);
         }
-        if (null != strategy.getExcludePopulation() && !"".equals(strategy.getExcludePopulation())) {
-            JSONArray excludePopulation = JSON.parseArray(strategy.getExcludePopulation());
-            targetJsonObject.put("exclude_population", excludePopulation);
+        // APP行为-按APP名称
+        JSONArray appIds = JSONArray.parseArray(strategy.getAppIds());
+        if (!Check.isNull(appIds)) {
+            targetJsonObject.put("app_ids", appIds);
         }
+        // 人群包定向
+        JSONArray populationString = JSONArray.parseArray(strategy.getPopulation());
+        if (!Check.isNull(populationString)) {
+            targetJsonObject.put("population", populationString);
+        }
+        // 人群包排除
+        JSONArray excludePopulationString = JSONArray.parseArray(strategy.getExcludePopulation());
+        if (!Check.isNull(excludePopulationString)) {
+            targetJsonObject.put("exclude_population", excludePopulationString);
+        }
+        // 付费人群包id
+        JSONArray paidAudienceString = JSONArray.parseArray(strategy.getPaidAudience());
+        if (!Check.isNull(paidAudienceString)) {
+            targetJsonObject.put("paid_audience", paidAudienceString);
+        }
+
         //是否开启智能扩量
-        if (null != strategy.getIsOpen() && strategy.getIsOpen().equals(1)) {
-            JSONObject intelliExtend = new JSONObject();
-            intelliExtend.put("is_open", 1);
-            if (null != strategy.getNoAgeBreak() && strategy.getNoAgeBreak().equals(1)) {
-                intelliExtend.put("no_age_break", 1);
-            }
-            if (null != strategy.getNoGenderBreak() && strategy.getNoGenderBreak().equals(1)) {
-                intelliExtend.put("no_gender_break", 1);
-            }
-            if (null != strategy.getNoAreaBreak() && strategy.getNoAreaBreak().equals(1)) {
-                intelliExtend.put("no_area_break", 1);
+        if (sceneId != 5) {
+            if (null != strategy.getIsOpen() && strategy.getIsOpen().equals(1)) {
+                JSONObject intelliExtend = new JSONObject();
+                intelliExtend.put("is_open", 1);
+                if (null != strategy.getNoAgeBreak() && strategy.getNoAgeBreak().equals(1)) {
+                    intelliExtend.put("no_age_break", 1);
+                }
+                if (null != strategy.getNoGenderBreak() && strategy.getNoGenderBreak().equals(1)) {
+                    intelliExtend.put("no_gender_break", 1);
+                }
+                if (null != strategy.getNoAreaBreak() && strategy.getNoAreaBreak().equals(1)) {
+                    intelliExtend.put("no_area_break", 1);
+                }
+                targetJsonObject.put("intelli_extend", intelliExtend);
             }
-            targetJsonObject.put("intelli_extend", intelliExtend);
         }
         unitParams.put("target", targetJsonObject);
         log.info("广告组创建参数:{}", unitParams.toJSONString());
@@ -1045,30 +1071,30 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
 
         }
         // APP行为-按分类
-        String appInterestString = strategy.getAppInterest();
-        if (null != appInterestString && !"".equals(appInterestString.trim())) {
-            target.put("app_interest", JSON.parseArray(appInterestString));
+        JSONArray appInterest = JSONArray.parseArray(strategy.getAppInterest());
+        if (!Check.isNull(appInterest)) {
+            target.put("app_interest", appInterest);
         }
         // APP行为-按APP名称
-        String appIdsString = strategy.getAppIds();
-        if (null != appIdsString && !"".equals(appIdsString.trim())) {
-            target.put("app_ids", JSON.parseArray(appIdsString));
+        JSONArray appIds = JSONArray.parseArray(strategy.getAppIds());
+        if (!Check.isNull(appIds)) {
+            target.put("app_ids", appIds);
         }
 
         // 人群包定向
-        String populationString = strategy.getPopulation();
-        if (null != populationString && !"".equals(populationString.trim())) {
-            target.put("population", JSON.parseArray(populationString));
+        JSONArray populationString = JSONArray.parseArray(strategy.getPopulation());
+        if (!Check.isNull(populationString)) {
+            target.put("population", populationString);
         }
         // 人群包排除
-        String excludePopulationString = strategy.getExcludePopulation();
-        if (null != excludePopulationString && !"".equals(excludePopulationString.trim())) {
-            target.put("exclude_population", JSON.parseArray(excludePopulationString));
+        JSONArray excludePopulationString = JSONArray.parseArray(strategy.getExcludePopulation());
+        if (!Check.isNull(excludePopulationString)) {
+            target.put("exclude_population", excludePopulationString);
         }
         // 付费人群包id
-        String paidAudienceString = strategy.getPaidAudience();
-        if (null != paidAudienceString && !"".equals(paidAudienceString.trim())) {
-            target.put("paid_audience", JSON.parseArray(paidAudienceString));
+        JSONArray paidAudienceString = JSONArray.parseArray(strategy.getPaidAudience());
+        if (!Check.isNull(paidAudienceString)) {
+            target.put("paid_audience", paidAudienceString);
         }
         if (Check.isNull(strategy.getBehaviorInterest())) {
             target.put("behavior_interest", JSON.parseObject(strategy.getBehaviorInterest()));
@@ -1171,11 +1197,19 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
         Map<String, Object> creativeCreateResult = kuaishouInterfaceService.creativeCreate(token.getAccessToken(), token.getAccountId(), creativeParams, 1);
         Integer creativeCode = (Integer) creativeCreateResult.get("code");
         String creativeMessage = (String) creativeCreateResult.get("message");
+
+        if (creativeCode == -1 && "/rest/openapi/v2/creative/create调用已超日限,次日可恢复调用".equals(creativeMessage)) {
+            updateService.updateUnitStatus(token.getAccessToken(), token.getAccountId(), unitId, 3, "e9ca23d68d884d4ebb19d07889727dae");
+        } else if (creativeCode == -1 && creativeMessage.contains("超过可关联的有效创意的上限")) {
+            updateService.updateUnitStatus(token.getAccessToken(), token.getAccountId(), unitId, 3, "e9ca23d68d884d4ebb19d07889727dae");
+        }
+
         AiKuaishouCreativeLevelOperationRecord record = new AiKuaishouCreativeLevelOperationRecord();
         BeanUtils.copyProperties(strategy, record);
         record.setCreativeName(creativeName);
         record.setStatus(creativeCode);
         record.setMessage(creativeMessage);
+        record.setUnitId(unitId);
         record.setAiStrategyUuid(uuid);
         record.setCreateTime(new Date());
         if (creativeCode != 0) {
@@ -1193,7 +1227,10 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
      * @param strategy 账户id
      * @return
      */
-    private String getName(String wildcard, AiKuaishouAdvertiserStrategy strategy, Integer createType, AiKuaiShouAppInfo appInfo, String timestamp, Integer cnt) {
+    @Autowired
+    private RedisUtil redisUtil;
+
+    private String getName(String wildcard, AiKuaishouAdvertiserStrategy strategy, Integer createType, AiKuaiShouAppInfo appInfo, String materialName, String type, Long campaignId) {
         if (wildcard.contains("{{应用包名}}")) {
             String appName = "";
             if (null != appInfo) {
@@ -1202,8 +1239,6 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
             wildcard = wildcard.replace("{{应用包名}}", appName);
         }
         if (wildcard.contains("{{创意制作方式}}")) {
-//            String creatype = KuaishouCreativeCreateTypeEnum.getNameByType(strategy.getOpenProgramCreate());
-//            wildcard = wildcard.replace("{{创意制作方式}}",creatype);
             if (strategy.getUnitType() == 4) {
                 wildcard = wildcard.replace("{{创意制作方式}}", "自定义");
             } else if (strategy.getUnitType() == 7) {
@@ -1214,20 +1249,59 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
             String adsence = getAdSenceByParams(strategy.getSceneId());
             wildcard = wildcard.replace("{{广告位置}}", adsence);
         }
+
+        if (wildcard.contains("{{素材名称}}")) {
+            if (Check.isNull(materialName)) {
+                wildcard = wildcard.replace("{{素材名称}}", "");
+            } else {
+                wildcard = wildcard.replace("{{素材名称}}", materialName);
+            }
+        }
         if (!wildcard.contains("{{自定义}}")) {
             wildcard = wildcard + "{{自定义}}";
         }
+        Date date = new Date();
+        String nowDate = DateUtils.formatDate(date, "yy-MMdd");
+        if (type.equals("plan")) {
+            if (wildcard.contains("{{日期}}")) {
+                wildcard = wildcard.replace("{{日期}}", nowDate);
+            } else {
+                wildcard = wildcard + "-" + nowDate;
+            }
+        } else if ("unit".equals(type)) {
+            wildcard = wildcard.replace("{{日期}}", nowDate);
+        }
+
         String targetName = KuaishouCreativeMatTypeEnum.getNameByType(strategy.getUnitType().toString() + createType.toString());
         if (null != appInfo) {
             targetName = appInfo.getAppVersion() + "-" + targetName;
         }
         wildcard = wildcard.replace("{{自定义}}", targetName);
 
-        if (null != timestamp && !"".equals(timestamp.trim())) {
-            wildcard = wildcard + "-" + timestamp;
-        }
-        if (null != cnt) {
-            wildcard = wildcard + "-" + cnt.toString();
+        if (!Check.isNull(campaignId)) {
+            Integer count = null;
+            if (null != strategy.getSingleAppid() && strategy.getSingleAppid() == 0) {
+                String redisKey = strategy.getAccountId() + "_" + campaignId;
+                Object redisValue = redisUtil.get(redisKey);
+                if (Check.isNull(redisValue)) {
+                    count = 1;
+                    redisUtil.set(redisKey, count);
+                } else {
+                    count = (Integer) redisValue + 1;
+                    redisUtil.set(redisKey, count);
+                }
+            } else {
+                String redisKey = strategy.getAccountId() + "_" + campaignId + nowDate;
+                Object redisValue = redisUtil.get(redisKey);
+                if (Check.isNull(redisValue)) {
+                    count = 1;
+                    redisUtil.set(redisKey, count, 100000L);
+                } else {
+                    count = (Integer) redisValue + 1;
+                    redisUtil.set(redisKey, count, 100000L);
+                }
+            }
+            wildcard = wildcard + "-" + count;
         }
         wildcard = wildcard.replace("--", "-");
         if (wildcard.startsWith("-")) {
@@ -1253,4 +1327,14 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
         }
         return adsence.substring(0, adsence.length() - 1);
     }
+
+
+    public static void main(String[] args) {
+        Date date = new Date();
+        String s = DateUtils.formatDate(date, "yy-MMdd");
+        String timestamp = DateUtils.formatDate(new Date(), "HHmmss");
+        System.err.println(timestamp);
+    }
+
+
 }

+ 76 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/app/entity/KuaishouAccountBalanceBudget.java

@@ -0,0 +1,76 @@
+package cn.com.ctop.kuaishou.modules.app.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.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * 快手-账余额、预算
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2021-04-16
+ */
+@Data
+@TableName("ctop_kuaishou_account_balance_budget")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_kuaishou_account_balance_budget对象", description = "快手-账余额、预算")
+public class KuaishouAccountBalanceBudget {
+
+    /**
+     * id
+     */
+    @TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "id")
+    private Long id;
+    /**
+     * 账户ID
+     */
+    @Excel(name = "账户ID", width = 15)
+    @ApiModelProperty(value = "账户ID")
+    private Long accountId;
+    /**
+     * 状态 0 失效,1有效
+     */
+    private Integer state;
+
+    /**
+     * 账户总余额
+     */
+    @Excel(name = "账户总余额", width = 15)
+    @ApiModelProperty(value = "账户总余额")
+    private BigDecimal balance;
+    /**
+     * 单日预算
+     */
+    @Excel(name = "单日预算", width = 15)
+    @ApiModelProperty(value = "单日预算")
+    private BigDecimal dayBudget;
+    /**
+     * 分日预算
+     */
+    @Excel(name = "分日预算", width = 15)
+    @ApiModelProperty(value = "分日预算")
+    private String dayBudgetSchedule;
+    /**
+     * 创建时间
+     */
+    @ApiModelProperty(value = "创建时间")
+    private Date createTime;
+    /**
+     * updateTime
+     */
+    @ApiModelProperty(value = "updateTime")
+    private Date updateTime;
+}

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

@@ -0,0 +1,19 @@
+package cn.com.ctop.kuaishou.modules.app.mapper;
+
+
+import cn.com.ctop.kuaishou.modules.app.entity.KuaishouAccountBalanceBudget;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 快手-账余额、预算
+ *
+ * @author: jeecg-boot
+ * @date: 2021-04-16
+ * @cersion: V1.0
+ */
+public interface KuaishouAccountBalanceBudgetMapper extends BaseMapper<KuaishouAccountBalanceBudget> {
+
+    void replace(KuaishouAccountBalanceBudget budget);
+
+    void updateAllIsInvalidState();
+}

+ 36 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/app/mapper/xml/KuaishouAccountBalanceBudgetMapper.xml

@@ -0,0 +1,36 @@
+<?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.app.mapper.KuaishouAccountBalanceBudgetMapper">
+
+    <insert id="replace">
+        replace
+        into ctop_kuaishou_account_balance_budget
+        (
+        id,
+        account_id ,
+        balance ,
+        day_budget ,
+        day_budget_schedule ,
+        state,
+        create_time
+        )
+        values
+        (
+        #{id},
+        #{accountId},
+        #{balance},
+        #{dayBudget},
+        #{dayBudgetSchedule},
+        #{state},
+        #{createTime}
+        )
+    </insert>
+
+
+    <update id="updateAllIsInvalidState">
+        update ctop_kuaishou_account_balance_budget
+        set state =0
+        where 1 = 1
+    </update>
+
+</mapper>

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

@@ -0,0 +1,18 @@
+package cn.com.ctop.kuaishou.modules.app.service;
+
+
+import cn.com.ctop.kuaishou.modules.app.entity.KuaishouAccountBalanceBudget;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * @Description: 快手-账余额、预算
+ * @Author: jeecg-boot
+ * @Date: 2021-04-16
+ * @Version: V1.0
+ */
+public interface IKuaishouAccountBalanceBudgetService extends IService<KuaishouAccountBalanceBudget> {
+
+    void replace(KuaishouAccountBalanceBudget budget);
+
+    void updateAllIsInvalidState();
+}

+ 32 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/app/service/impl/KuaishouAccountBalanceBudgetServiceImpl.java

@@ -0,0 +1,32 @@
+package cn.com.ctop.kuaishou.modules.app.service.impl;
+
+import cn.com.ctop.kuaishou.modules.app.entity.KuaishouAccountBalanceBudget;
+import cn.com.ctop.kuaishou.modules.app.mapper.KuaishouAccountBalanceBudgetMapper;
+import cn.com.ctop.kuaishou.modules.app.service.IKuaishouAccountBalanceBudgetService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+/**
+ * 快手-账余额、预算
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2021-04-16
+ */
+@Service
+public class KuaishouAccountBalanceBudgetServiceImpl extends ServiceImpl<KuaishouAccountBalanceBudgetMapper, KuaishouAccountBalanceBudget> implements IKuaishouAccountBalanceBudgetService {
+
+    @Autowired
+    private KuaishouAccountBalanceBudgetMapper budgetMapper;
+
+    @Override
+    public void replace(KuaishouAccountBalanceBudget budget) {
+        budgetMapper.replace(budget);
+    }
+
+    @Override
+    public void updateAllIsInvalidState() {
+        budgetMapper.updateAllIsInvalidState();
+    }
+}

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

@@ -109,7 +109,6 @@ public class BatchController {
             SpendVo spendVo = new SpendVo();
             JSONObject fundJson = iKuaishouInterfaceService.fundGet(oauthToken);
 
-
             if (!Check.isNull(fundJson)) {
                 spendVo.setBalance(fundJson.getBigDecimal("balance")); // 余额
             }
@@ -120,15 +119,7 @@ public class BatchController {
             spendVo.setBudget(budget);
             result.setSuccess(true);
             result.setResult(spendVo);
-
             String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
-            String startDate = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -1);
-            String endDate = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, 1);
-
-
-            iKuaishouInterfaceService.getCampaignList(oauthToken, new java.util.Date(), new java.util.Date());
-
-
             Thread thread = new Thread() {
                 @Override
                 public void run() {
@@ -149,21 +140,12 @@ public class BatchController {
             Thread thread2 = new Thread() {
                 @Override
                 public void run() {
-                    // syncPullMaterialService.getSyncVideoList(accountId, nowDate, nowDate);
                     iKuaishouInterfaceService.getVideoList(oauthToken, nowDate, nowDate);
 
                 }
             };
             thread2.start();
 
-          /*  Thread thread3 = new Thread() {
-                @Override
-                public void run() {
-                    iKuaishouInterfaceService.getSuZaoList(oauthToken.getAccessToken(), accountId, 1, nowDate, endDate);
-                }
-            };
-            thread3.start();*/
-
             Thread thread4 = new Thread() {
                 @Override
                 public void run() {
@@ -172,7 +154,6 @@ public class BatchController {
                 }
             };
             thread4.start();
-
         } catch (Exception e) {
             e.printStackTrace();
             result.setSuccess(false);
@@ -198,10 +179,11 @@ public class BatchController {
                                                            @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                            HttpServletRequest req) {
         Result<IPage<KuaiShouCampaign>> result = new Result<>();
+        CtopOauthToken oauthToken = oauthTokenService.getTokenByAccountId(kuaiShouCampaign.getAccountId());
+        iKuaishouInterfaceService.getCampaignList(oauthToken, new java.util.Date(), new java.util.Date());
         String campaignName = kuaiShouCampaign.getCampaignName();
         kuaiShouCampaign.setCampaignName(null);
         if (!Check.isNull(kuaiShouCampaign.getCampaignId())) {
-            CtopOauthToken oauthToken = oauthTokenService.getTokenByAccountId(kuaiShouCampaign.getAccountId());
             iKuaishouInterfaceService.getCampaign(oauthToken.getAccessToken(), kuaiShouCampaign.getAccountId(), kuaiShouCampaign.getCampaignId());
         }
         QueryWrapper<KuaiShouCampaign> queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouCampaign, req.getParameterMap());
@@ -2436,4 +2418,39 @@ public class BatchController {
     }
 
 
+    /**
+     * 获取可选的深度类型
+     *
+     * @return
+     */
+    @PostMapping(value = "/getAppNames")
+    public Result<JSONArray> getAppNames(@RequestBody JSONObject requestJson) {
+        Result result = new Result<JSONArray>();
+        try {
+            Long accountId = requestJson.getLong("accountId");
+
+            CtopOauthToken token = oauthTokenService.getTokenByAccountId(accountId);
+            if (Check.isNull(token)) {
+                throw new Exception("未获取授权信息");
+            }
+            JSONArray appIds = requestJson.getJSONArray("appIds");
+
+            if (!Check.isNull(appIds)) {
+                JSONArray appNames = iKuaishouInterfaceService.getAppNames(accountId, token.getAccessToken(), appIds);
+                result.setResult(appNames);
+            } else {
+                result.setResult(new JSONArray());
+            }
+            result.setSuccess(true);
+        } catch (Exception e) {
+            e.printStackTrace();
+            result.setSuccess(false);
+            result.setMessage(e.getMessage());
+        }
+
+        return result;
+
+    }
+
+
 }

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

@@ -87,6 +87,7 @@ public class KuaiShouVideoGetController {
                                                              String endDate,
                                                              String materialType,
                                                              String channelType,
+                                                             String signatures,
                                                              String orderBy,
                                                              @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                              @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
@@ -107,6 +108,7 @@ public class KuaiShouVideoGetController {
             if (Check.isNull(orderBy)) {
                 throw new Exception("请传入排序方式");
             }
+
             List<KuaiShouVideoGetVo> list = new ArrayList<>();
             PageHelper.startPage(pageNo, pageSize);
             Map<String, Object> requestMap = new HashMap<>();
@@ -114,6 +116,10 @@ public class KuaiShouVideoGetController {
             requestMap.put("orderBy", orderBy);
             requestMap.put("materialType", materialType);
             requestMap.put("channelType", channelType);
+            if(!Check.isNull(signatures)){
+                String[] signatureArray =  signatures.split(",");
+                requestMap.put("signatureList", signatureArray);
+            }
             if ("time".equals(orderBy)) {
                 if (!Check.isNull(startDate) && !Check.isNull(endDate)) {
                     requestMap.put("startDate", startDate);

+ 1 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/entity/KuaiShouGroupTemplate.java

@@ -216,6 +216,7 @@ public class KuaiShouGroupTemplate {
     private String creativeReviewDetail;
     private Integer createType;
     private String photoIds;
+    private String schemaUri;
 
     /**
      * 创建时间

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

@@ -334,7 +334,13 @@
         <if test="endDate != null and endDate != '' ">
             and t1.stat_date &lt;= #{endDate}
         </if>
-
+        <if test="signatureList != null and signatureList != '' ">
+            and t1.signature in
+            <foreach collection="signatureList" item="item" separator=","
+                     open="(" close=")">
+                #{item}
+            </foreach>
+        </if>
         GROUP BY
         signature
         ORDER BY

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

@@ -58,6 +58,13 @@
         <if test="endDate != null and endDate != '' ">
             and stat_date &lt;= #{endDate}
         </if>
+        <if test="signatureList != null and signatureList != '' ">
+            and signature in
+              <foreach collection="signatureList" item="item" separator=","
+                             open="(" close=")">
+                    #{item}
+                </foreach>
+        </if>
         group by signature
         order by stat_date desc
     </select>

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

@@ -1,5 +1,6 @@
 package cn.com.ctop.kuaishou.modules.batch.service;
 
+import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouCreative;
 import com.alibaba.fastjson.JSONArray;
 import com.baomidou.mybatisplus.extension.service.IService;
@@ -70,4 +71,7 @@ public interface IKuaiShouCreativeService extends IService<KuaiShouCreative> {
     String getClickTrackUrl(Long accountId, Long unitId);
 
     List<KuaiShouCreative> getCreativeListByAccountIdAndUnitId(Long accountId, Long unitId);
+
+
+    void getProgramCreative(CtopOauthToken oauthToken, int page);
 }

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

@@ -17,11 +17,13 @@ public interface IKuaiShouReportDailyMaterialService extends IService<KuaiShouRe
 
     List<KuaiShouVideoGetVo> getVideoList(Map<String, Object> requestMap);
 
-    void getMaterialReportByAccountIdAndStatDate(Long accountId, String token, String startDate, String endDate, Integer page);
+    void getMaterialReportByAccountIdAndStatDate(Long accountId, String token, String startDate, String endDate, String temporalGranularity, Integer page);
 
     List<KuaiShouReportDailyMaterial> getSignatureByDate(String date);
 
-    KuaiShouReportDailyMaterial getEtlDataByParams(String signature, String date,Long projectId);
+    KuaiShouReportDailyMaterial getEtlDataByParams(String signature, String date, Long projectId);
 
     List<KuaiShouReportDailyMaterial> getSignatureByDateGroupByProjectId(String date);
+
+    List<KuaiShouReportDailyMaterial> getVideoInfoByList(List<KuaiShouReportDailyMaterial> addList, List<Long> photoIdList);
 }

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

@@ -5,11 +5,7 @@ import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.kuaishou.modules.batch.entity.vo.ConvertVo;
 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.KuaishouReportDailyCampaign;
-import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyCreative;
-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.KuaishouReportHourlyGroup;
+import cn.com.ctop.kuaishou.modules.report.entity.*;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 
@@ -316,14 +312,6 @@ public interface IKuaishouInterfaceService {
      */
     void getAdvertiserCampaignReportHourly(CtopOauthToken token, Date startDate, Date endDate);
 
-    /**
-     * 获取组时报
-     *
-     * @param token
-     * @param startDate
-     * @param endDate
-     */
-    void getAdvertiserGroupReportHourly(CtopOauthToken token, Date startDate, Date endDate);
 
     /**
      * 获取创意时报 暂停使用
@@ -480,6 +468,7 @@ public interface IKuaishouInterfaceService {
 
     void getCreativeByCreativeIds(String accessToken, Long advertiserId, JSONArray creativeIds);
 
+    JSONArray getAppNames(Long accountId, String accessToken, JSONArray appIds);
 }
 
 

+ 7 - 2
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/BatchServiceImpl.java

@@ -240,6 +240,9 @@ public class BatchServiceImpl implements IBatchService {
         if (!Check.isNull(requestJson.getString("url"))) {
             unitJson.put("url", requestJson.getString("url"));
         }
+        if (!Check.isNull(requestJson.getString("schemaUri"))) {
+            unitJson.put("schema_uri", requestJson.getString("schemaUri"));
+        }
         // appId
         if (!Check.isNull(requestJson.getLong("appId"))) {
             unitJson.put("app_id", requestJson.getLong("appId"));
@@ -894,6 +897,10 @@ public class BatchServiceImpl implements IBatchService {
                 if (!Check.isNull(group.getUrl())) {
                     unitJson.put("url", group.getUrl());
                 }
+                //  吊起链接
+                if (!Check.isNull(group.getSchemaUri())) {
+                    unitJson.put("schema_uri", group.getSchemaUri());
+                }
                 // appId
                 if (!Check.isNull(group.getAppId())) {
                     unitJson.put("app_id", group.getAppId());
@@ -922,8 +929,6 @@ public class BatchServiceImpl implements IBatchService {
                     // 自定义年龄段
                     Integer ageMin = groupTarget.getAgeMin();
                     Integer ageMax = groupTarget.getAgeMax();
-
-
                     JSONObject ageJson = new JSONObject();
                     if (!Check.isNull(ageMin)) {
                         ageJson.put("min", ageMin);

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

@@ -45,10 +45,11 @@ public class KuaiShouActionBarTextServiceImpl extends ServiceImpl<KuaiShouAction
         queryWrapper.last("limit 1");
         CtopOauthToken token = tokenService.getOne(queryWrapper);
         List list = new ArrayList();
-        list.add(2);
+     /*   list.add(2);
         list.add(3);
         list.add(4);
-        list.add(5);
+        list.add(5);*/
+        list.add(7);
         String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.ACTION_BAR_TEXT_LIST;
         Map<String, String> headers = new HashMap<>();
         headers.put("Access-Token", token.getAccessToken());
@@ -60,6 +61,7 @@ public class KuaiShouActionBarTextServiceImpl extends ServiceImpl<KuaiShouAction
             requestJson.put("campaign_type", list.get(i));
             String result = HttpUtils.kuaiShouhttpPostRequest(url, requestJson.toJSONString(), headers);
             JSONObject resultJson = JSONObject.parseObject(result);
+            System.err.println(resultJson);
             Integer code = resultJson.getInteger("code");
             if (code == 0) {
                 JSONObject data = resultJson.getJSONObject("data");
@@ -69,7 +71,7 @@ public class KuaiShouActionBarTextServiceImpl extends ServiceImpl<KuaiShouAction
                     if (!Check.isNull(action_bar_text)) {
                         Map<String, Object> deleteMap = new HashMap<>();
                         deleteMap.put("type", campaign_type);
-                        actionBarTextMapper.deleteByMap(deleteMap);
+                   //     actionBarTextMapper.deleteByMap(deleteMap);
                         for (int j = 0; j < action_bar_text.size(); j++) {
                             String actionBarText = action_bar_text.getString(j);
                             KuaiShouActionBarText kuaiShouActionBarText = new KuaiShouActionBarText();

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

@@ -1,5 +1,6 @@
 package cn.com.ctop.kuaishou.modules.batch.service.impl;
 
+import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.HttpUtils;
 import cn.com.ctop.common.module.utils.KuaishouInterfaceConstant;
@@ -304,4 +305,79 @@ public class KuaiShouCreativeServiceImpl extends ServiceImpl<KuaiShouCreativeMap
     }
 
 
+    @Override
+    public void getProgramCreative(CtopOauthToken token, int page) {
+
+        log.info("获取视频数据,accountId:{}", token.getAccountId());
+        String url1 = "https://ad.e.kuaishou.com/rest/openapi/v2/creative/advanced/program/list";
+        Map<String, String> headers = new HashMap<>();
+        headers.put("Content-Type", "application/json");
+        headers.put("Access-Token", token.getAccessToken());
+        Map<String, Object> param = new HashMap<>();
+        param.put("advertiser_id", token.getAccountId());
+        param.put("page_size", 500);
+        param.put("page", page);
+
+        String result = HttpUtils.httpPostRequest(url1, param, headers);
+        JSONObject resultJson = JSONObject.parseObject(result);
+        Integer code = resultJson.getInteger("code");
+        String message = resultJson.getString("message");
+        if (null == code || code != 0) {
+            log.error("获取快手视频列表数据异常:{},accountId:{}", message, token.getAccountId());
+            return;
+        }
+        JSONObject dataJson = resultJson.getJSONObject("data");
+        if (Check.isNull(dataJson)) {
+            return;
+        }
+        JSONArray details = dataJson.getJSONArray("details");
+        if (Check.isNull(details)) {
+            return;
+        }
+
+        for (int i = 0; i < details.size(); i++) {
+            JSONObject jsonObject = details.getJSONObject(i);
+            if (Check.isNull(jsonObject)) {
+                continue;
+            }
+
+            String updateUrl = "https://ad.e.kuaishou.com/rest/openapi/v2/creative/advanced/program/update";
+
+            Map<String, String> headers1 = new HashMap<>();
+            headers1.put("Content-Type", "application/json");
+            headers1.put("Access-Token", token.getAccessToken());
+            Map<String, Object> param1 = new HashMap<>();
+            param1.put("advertiser_id", token.getAccountId());
+            param1.put("unit_id", jsonObject.getLong("unit_id"));
+
+          /*  String clickTrackUrl = jsonObject.getString("click_url").replace("&idfa_md5=__IDFA__", "").replace("&idfa_md5=__IDFA2__", "");
+            if (Check.isNull(clickTrackUrl)) {
+                continue;
+            }
+
+            if (clickTrackUrl.contains("&ad_name=__DNAME__")) {
+                continue;
+            }*/
+
+            String replaceUrll = "https://click-wailaxin.1sapp.com/vendor/feedback/reportClick?platform=kuaishou&feedback_type=android&account_id=19&plan_id=__DID__&adgroup_id=__AID__&creative_id=__CID__&imei=__IMEI2__&mac=__MAC__&androidid=__ANDROIDID2__&ts=__TS__&ip=__IP__&ua=__UA__&callback=__CALLBACK__&oaid=__OAID__&app=dxqlb";
+
+            param1.put("click_url", replaceUrll);
+            String result1 = HttpUtils.httpPostRequest(updateUrl, param1, headers1);
+            JSONObject resultJson1 = JSONObject.parseObject(result1);
+            Integer code1 = resultJson1.getInteger("code");
+            if (code1 == 0) {
+                log.info("修改成功,accountId:{},unitId:{}", token.getAccountId(), jsonObject.getLong("unit_id"));
+
+            } else {
+                log.info("修改失败,accountId:{},unitId:{},原因:{}", token.getAccountId(), jsonObject.getLong("unit_id"), resultJson1.getString("message"));
+            }
+
+
+        }
+
+        getProgramCreative(token, page + 1);
+
+    }
+
+
 }

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

@@ -122,6 +122,7 @@ public class KuaiShouGroupTemplateServiceImpl extends ServiceImpl<KuaiShouGroupT
         String action_bar_text = requestJson.getString("actionBarText");
         String description = requestJson.getString("description");
         Long site_id = requestJson.getLong("siteId");
+        String schema_uri = requestJson.getString("schemaUri");
 
 
         List<KuaiShouGroupTemplate> templates = new ArrayList<>();
@@ -198,6 +199,9 @@ public class KuaiShouGroupTemplateServiceImpl extends ServiceImpl<KuaiShouGroupT
             if (!Check.isNull(url)) {
                 template.setUrl(url);
             }
+            if (!Check.isNull(schema_uri)) {
+                template.setSchemaUri(schema_uri);
+            }
             if (!Check.isNull(app_id)) {
                 template.setAppId(app_id);
             }
@@ -372,6 +376,10 @@ public class KuaiShouGroupTemplateServiceImpl extends ServiceImpl<KuaiShouGroupT
         if (!Check.isNull(template.getUrl())) {
             createUnitJson.put("url", template.getUrl()); // 投放链接
         }
+        if (!Check.isNull(template.getSchemaUri())) {
+            createUnitJson.put("schema_uri", template.getSchemaUri()); // 吊起链接
+        }
+
         if (!Check.isNull(template.getAppId())) {
             createUnitJson.put("app_id", template.getAppId()); // 应用ID
         }

+ 194 - 7
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouHistoryReportTaskServiceImpl.java

@@ -9,19 +9,24 @@ import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouHistoryReportTaskMapper
 import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouReportDailyMaterialMapper;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouDailyReportTaskService;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouHistoryReportTaskService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouReportDailyMaterialService;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaiShouReportDailyMaterial;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaiShouReportDailyMaterialVo;
+import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAccount;
 import cn.com.ctop.kuaishou.modules.report.entity.VideoGetvo;
 import cn.com.ctop.kuaishou.modules.report.mapper.*;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.csvreader.CsvReader;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
+import java.io.IOException;
+import java.nio.charset.Charset;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -62,6 +67,10 @@ public class KuaiShouHistoryReportTaskServiceImpl extends ServiceImpl<KuaiShouHi
 
     @Autowired
     private KuaiShouReportDailyMaterialMapper kuaishouReportDailyMaterialMapper;
+    @Autowired
+    private IKuaiShouReportDailyMaterialService reportDailyMaterialService;
+    @Autowired
+    private KuaiShouReportDailyMaterialMapper dailyMaterialMapper;
 
     @Override
     public void createTask(Long accountId, String token, String startDate, String endDate, String taskType) {
@@ -213,7 +222,166 @@ public class KuaiShouHistoryReportTaskServiceImpl extends ServiceImpl<KuaiShouHi
             requestMap.put("advertiser_id", task.getAccountId());
             requestMap.put("task_id", task.getTaskId());
             String localPath = LoadFileUtil.downloadByUrl(requestMap, downloadPath, url, token, fileName);
-            if (!Check.isNull(localPath)) {
+            ArrayList<String[]> reportList = getReportList(localPath);
+            if (task.getViewType() == 1) {
+                if (!Check.isNull(reportList)) {
+                    List<KuaishouReportDailyAccount> reportDailyAccounts = new ArrayList<>();
+                    for (int row = 0; row < reportList.size(); row++) {
+                        if (Check.isNull(row)) {
+                            continue;
+                        }
+                        KuaishouReportDailyAccount reportDailyAccount = new KuaishouReportDailyAccount();
+                        reportDailyAccount.setAccountId(task.getAccountId());
+                        reportDailyAccount.setCharge(ConverterUtils.getAsBigDecimal(reportList.get(row)[1]));
+                        reportDailyAccount.setAdScene(reportList.get(row)[0]);
+                        reportDailyAccount.setPhotoShow(ConverterUtils.getAsLong(reportList.get(row)[2]));
+                        reportDailyAccount.setAclick(ConverterUtils.getAsLong(reportList.get(row)[3]));
+                        reportDailyAccount.setBclick(ConverterUtils.getAsLong(reportList.get(row)[4]));
+                        reportDailyAccount.setPhotoShare(ConverterUtils.getAsLong(reportList.get(row)[5]));
+                        reportDailyAccount.setPhotoComment(ConverterUtils.getAsLong(reportList.get(row)[6]));
+                        reportDailyAccount.setPhotoLike(ConverterUtils.getAsLong(reportList.get(row)[7]));
+                        reportDailyAccount.setFollow(ConverterUtils.getAsLong(reportList.get(row)[8]));
+                        reportDailyAccount.setCancelFollow(ConverterUtils.getAsLong(reportList.get(row)[9]));
+                        reportDailyAccount.setReport(ConverterUtils.getAsLong(reportList.get(row)[10]));
+                        reportDailyAccount.setBlock(ConverterUtils.getAsLong(reportList.get(row)[11]));
+                        reportDailyAccount.setNegative(ConverterUtils.getAsLong(reportList.get(row)[12]));
+                        reportDailyAccount.setDownloadStarted(ConverterUtils.getAsLong(reportList.get(row)[13]));
+                        reportDailyAccount.setDownloadCompleted(ConverterUtils.getAsLong(reportList.get(row)[14]));
+                        reportDailyAccount.setActivation(ConverterUtils.getAsLong(reportList.get(row)[15]));
+                        reportDailyAccount.setSubmit(ConverterUtils.getAsLong(reportList.get(row)[16]));
+                        reportDailyAccount.setStatDate(reportList.get(row)[17]);
+                        reportDailyAccount.setPhotoClick(ConverterUtils.getAsLong(reportList.get(row)[19]));
+                        reportDailyAccount.setPhotoClickRatio(ConverterUtils.getAsDouble(reportList.get(row)[20]));
+                        reportDailyAccount.setActionRatio(ConverterUtils.getAsDouble(reportList.get(row)[21]));
+                        reportDailyAccount.setImpression1kCost(ConverterUtils.getAsBigDecimal(reportList.get(row)[22]));
+                        reportDailyAccount.setPhotoClickCost(ConverterUtils.getAsBigDecimal(reportList.get(row)[23]));
+                        reportDailyAccount.setActionCost(ConverterUtils.getAsBigDecimal(reportList.get(row)[25]));
+                        reportDailyAccount.setEventPayFirstDay(ConverterUtils.getAsLong(reportList.get(row)[26]));
+                        reportDailyAccount.setEventPayPurchaseAmountFirstDay(ConverterUtils.getAsBigDecimal(reportList.get(row)[27]));
+                        reportDailyAccount.setEventPayFirstDayRoi(ConverterUtils.getAsDouble(reportList.get(row)[28]));
+                        reportDailyAccount.setEventPay(ConverterUtils.getAsLong(reportList.get(row)[29]));
+                        reportDailyAccount.setEventPayPurchaseAmount(ConverterUtils.getAsBigDecimal(reportList.get(row)[30]));
+                        reportDailyAccount.setEventPayRoi(ConverterUtils.getAsDouble(reportList.get(row)[31]));
+                        reportDailyAccount.setEventRegister(ConverterUtils.getAsLong(reportList.get(row)[32]));
+                        reportDailyAccount.setEventRegisterCost(ConverterUtils.getAsBigDecimal(reportList.get(row)[33]));
+                        reportDailyAccount.setEventRegisterRatio(ConverterUtils.getAsDouble(reportList.get(row)[34]));
+                        reportDailyAccount.setEventJinJianApp(ConverterUtils.getAsLong(reportList.get(row)[35]));
+                        reportDailyAccount.setEventJinJianAppCost(ConverterUtils.getAsBigDecimal(reportList.get(row)[36]));
+                        reportDailyAccount.setEventCreditGrantApp(ConverterUtils.getAsLong(reportList.get(row)[37]));
+                        reportDailyAccount.setEventCreditGrantAppCost(ConverterUtils.getAsBigDecimal(reportList.get(row)[38]));
+                        reportDailyAccount.setEventCreditGrantAppRatio(ConverterUtils.getAsDouble(reportList.get(row)[39]));
+                        reportDailyAccount.setEventOrderPaid(ConverterUtils.getAsLong(reportList.get(row)[40]));
+                        reportDailyAccount.setEventOrderPaidPurchaseAmount(ConverterUtils.getAsBigDecimal(reportList.get(row)[41]));
+                        reportDailyAccount.setEventOrderPaidCost(ConverterUtils.getAsBigDecimal(reportList.get(row)[42]));
+                        reportDailyAccount.setFormCount(ConverterUtils.getAsLong(reportList.get(row)[43]));
+                        reportDailyAccount.setFormCost(ConverterUtils.getAsBigDecimal(reportList.get(row)[44]));
+                        reportDailyAccount.setFormActionRatio(ConverterUtils.getAsDouble(reportList.get(row)[45]));
+                        reportDailyAccount.setEventJinJianLandingPage(ConverterUtils.getAsLong(reportList.get(row)[46]));
+                        reportDailyAccount.setEventJinJianLandingPageCost(ConverterUtils.getAsBigDecimal(reportList.get(row)[47]));
+                        reportDailyAccount.setEventCreditGrantLandingPage(ConverterUtils.getAsLong(reportList.get(row)[48]));
+                        reportDailyAccount.setEventCreditGrantLandingPageCost(ConverterUtils.getAsBigDecimal(reportList.get(row)[49]));
+                        reportDailyAccount.setEventCreditGrantLandingRatio(ConverterUtils.getAsDouble(reportList.get(row)[50]));
+                        reportDailyAccount.setEventNextDayStayCost(ConverterUtils.getAsBigDecimal(reportList.get(row)[51]));
+                        reportDailyAccount.setEventNextDayStayRatio(ConverterUtils.getAsBigDecimal(reportList.get(row)[52]));
+                        reportDailyAccount.setEventNextDayStay(ConverterUtils.getAsLong(reportList.get(row)[53]));
+                        reportDailyAccount.setPlay3sRatio(ConverterUtils.getAsDouble(reportList.get(row)[54]));
+                        reportDailyAccount.setEventNewUserPay(ConverterUtils.getAsLong(reportList.get(row)[63]));
+                        reportDailyAccount.setEventNewUserPayCost(ConverterUtils.getAsBigDecimal(reportList.get(row)[64]));
+                        reportDailyAccount.setEventNewUserPayRatio(ConverterUtils.getAsBigDecimal(reportList.get(row)[65]));
+                        reportDailyAccounts.add(reportDailyAccount);
+                    }
+                    if (!Check.isNull(reportDailyAccounts)) {
+                        reportDailyAccountMapper.replaceBatch(reportDailyAccounts);
+                    }
+                }
+            } else if (task.getViewType() == 5) {
+                if (!Check.isNull(reportList)) {
+                    List<KuaiShouReportDailyMaterial> materialList = new ArrayList<>();
+                    List<Long> photoIdList = new ArrayList<>();
+                    for (int row = 0; row < reportList.size(); row++) {
+                        String[] strings = reportList.get(row);
+                        if (Check.isNull(strings)) {
+                            continue;
+                        }
+                        KuaiShouReportDailyMaterial material = new KuaiShouReportDailyMaterial();
+                        material.setAccountId(task.getAccountId());
+                        material.setPhotoId(ConverterUtils.getAsLong(strings[0]));
+                        photoIdList.add(ConverterUtils.getAsLong(strings[0]));
+                        material.setImageToken(strings[1]);
+                        material.setCoverUrl(strings[2]);
+                        material.setPhotoUrl(strings[3]);
+                        // 4
+                        material.setCreativeMaterialTypeString(strings[5]);
+                        material.setAdScene(strings[6]);
+                        material.setCharge(ConverterUtils.getAsBigDecimal(strings[7]));
+                        material.setPhotoShow(ConverterUtils.getAsLong(strings[8]));
+                        material.setAclick(ConverterUtils.getAsLong(strings[9]));
+                        material.setBclick(ConverterUtils.getAsLong(strings[10]));
+                        material.setPhotoShare(ConverterUtils.getAsInteger(strings[11]));
+                        material.setPhotoComment(ConverterUtils.getAsInteger(strings[12]));
+                        material.setPhotoLike(ConverterUtils.getAsInteger(strings[13]));
+                        material.setFollow(ConverterUtils.getAsInteger(strings[14]));
+                        material.setCancelFollow(ConverterUtils.getAsInteger(strings[15]));
+                        material.setReport(ConverterUtils.getAsInteger(strings[16]));
+                        material.setBlock(ConverterUtils.getAsInteger(strings[17]));
+                        material.setNegative(ConverterUtils.getAsInteger(strings[18]));
+                        material.setDownloadStarted(ConverterUtils.getAsInteger(strings[19]));
+                        material.setDownloadCompleted(ConverterUtils.getAsInteger(strings[20]));
+                        material.setActivation(ConverterUtils.getAsInteger(strings[21]));
+                        material.setSubmit(ConverterUtils.getAsInteger(strings[22]));
+                        material.setStatDate(strings[23]);
+                        // 24
+                        material.setPhotoClick(ConverterUtils.getAsLong(strings[25]));
+                        material.setPhotoClickRatio(ConverterUtils.getAsDouble(strings[26]));
+                        material.setActionRatio(ConverterUtils.getAsDouble(strings[27]));
+                        material.setImpression1kCost(ConverterUtils.getAsBigDecimal(strings[28]));
+                        material.setPhotoClickCost(ConverterUtils.getAsBigDecimal(strings[29]));
+                        // material.setClick1(ConverterUtils.getAsBigDecimal(strings[30]));
+                        material.setActionCost(ConverterUtils.getAsBigDecimal(strings[31]));
+                        material.setEventPayFirstDay(ConverterUtils.getAsInteger(strings[32]));
+                        material.setEventPayPurchaseAmountFirstDay(ConverterUtils.getAsBigDecimal(strings[33]));
+                        material.setEventPayFirstDayRoi(ConverterUtils.getAsDouble(strings[34]));
+                        material.setEventPay(ConverterUtils.getAsInteger(strings[35]));
+                        material.setEventPayPurchaseAmount(ConverterUtils.getAsBigDecimal(strings[36]));
+                        material.setEventPayRoi(ConverterUtils.getAsDouble(strings[37]));
+                        material.setEventRegister(ConverterUtils.getAsInteger(strings[38]));
+                        material.setEventRegisterCost(ConverterUtils.getAsBigDecimal(strings[39]));
+                        material.setEventRegisterRatio(ConverterUtils.getAsDouble(strings[40]));
+                        material.setEventJinJianApp(ConverterUtils.getAsInteger(strings[41]));
+                        material.setEventJinJianAppCost(ConverterUtils.getAsBigDecimal(strings[42]));
+                        material.setEventCreditGrantApp(ConverterUtils.getAsInteger(strings[43]));
+                        material.setEventCreditGrantAppCost(ConverterUtils.getAsBigDecimal(strings[44]));
+                        material.setEventCreditGrantAppRatio(ConverterUtils.getAsDouble(strings[45]));
+                        material.setEventOrderPaid(ConverterUtils.getAsInteger(strings[46]));
+                        material.setEventOrderPaidPurchaseAmount(ConverterUtils.getAsBigDecimal(strings[47]));
+                        material.setEventOrderPaidCost(ConverterUtils.getAsBigDecimal(strings[48]));
+                        material.setFormCount(ConverterUtils.getAsInteger(strings[49]));
+                        material.setFormCost(ConverterUtils.getAsBigDecimal(strings[50]));
+                        material.setFormActionRatio(ConverterUtils.getAsDouble(strings[51]));
+                        material.setEventJinJianLandingPage(ConverterUtils.getAsInteger(strings[52]));
+                        material.setEventJinJianLandingPageCost(ConverterUtils.getAsBigDecimal(strings[53]));
+                        material.setEventCreditGrantLandingPage(ConverterUtils.getAsInteger(strings[54]));
+                        material.setEventCreditGrantLandingPageCost(ConverterUtils.getAsBigDecimal(strings[55]));
+                        material.setEventCreditGrantLandingRatio(ConverterUtils.getAsDouble(strings[56]));
+                        material.setEventNextDayStayCost(ConverterUtils.getAsBigDecimal(strings[57]));
+                        material.setEventNextDayStayRatio(ConverterUtils.getAsInteger(strings[58]));
+                        material.setEventNextDayStay(ConverterUtils.getAsInteger(strings[59]));
+                        material.setPlay3sRatio(ConverterUtils.getAsDouble(strings[60]));
+                        materialList.add(material);
+                    }
+                    if (!Check.isNull(materialList)) {
+                        List<KuaiShouReportDailyMaterial> videoInfoByList = reportDailyMaterialService.getVideoInfoByList(materialList, photoIdList);
+                        dailyMaterialMapper.batchReplace(videoInfoByList);
+
+                    }
+
+                }
+
+            }
+
+
+            //   System.err.println(reportList);
+          /*  if (!Check.isNull(localPath)) {
                 Map<String, Object> deleteMap = new HashMap<>();
                 deleteMap.put("account_id", task.getAccountId());
 
@@ -263,7 +431,7 @@ public class KuaiShouHistoryReportTaskServiceImpl extends ServiceImpl<KuaiShouHi
                 }
 
 
-            }
+            }*/
             task.setTaskStatus(4);
 
         } catch (Exception e) {
@@ -274,6 +442,24 @@ public class KuaiShouHistoryReportTaskServiceImpl extends ServiceImpl<KuaiShouHi
 
     }
 
+
+    private ArrayList<String[]> getReportList(String localPath) throws IOException {
+        ArrayList<String[]> csvFileList = new ArrayList<String[]>();
+        // 定义一个CSV路径
+        // 创建CSV读对象 例如:CsvReader(文件路径,分隔符,编码格式);
+        CsvReader reader = new CsvReader(localPath, ',', Charset.forName("UTF-8"));
+        // 跳过表头 如果需要表头的话,这句可以忽略
+        reader.readHeaders();
+        // 逐行读入除表头的数据
+        while (reader.readRecord()) {
+            //  System.out.println(reader.getRawRecord());
+            csvFileList.add(reader.getValues());
+        }
+        reader.close();
+        return csvFileList;
+
+    }
+
     @Autowired
     private KuaishouReportDailyImageMapper kuaishouReportDailyImageMapper;
 
@@ -282,12 +468,13 @@ public class KuaiShouHistoryReportTaskServiceImpl extends ServiceImpl<KuaiShouHi
 
         historyTypeList = new ArrayList<>();
         historyTypeList.add(1);
-        historyTypeList.add(2);
-        historyTypeList.add(3);
-        historyTypeList.add(4);
         historyTypeList.add(5);
-        historyTypeList.add(7);
-        historyTypeList.add(10);
+      /*  historyTypeList.add(2);
+        historyTypeList.add(3);*/
+        // historyTypeList.add(4);
+        //
+        // historyTypeList.add(7);
+        //  historyTypeList.add(10);
 
 
     }

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

@@ -6,6 +6,7 @@ import cn.com.ctop.kuaishou.modules.batch.entity.vo.KuaiShouVideoGetVo;
 import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouReportDailyMaterialMapper;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouReportDailyMaterialService;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaiShouReportDailyMaterial;
+import cn.com.ctop.kuaishou.modules.report.mapper.KuaiShouReportHourlyMaterialMapper;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -30,6 +31,8 @@ import java.util.Map;
 public class KuaiShouReportDailyMaterialServiceImpl extends ServiceImpl<KuaiShouReportDailyMaterialMapper, KuaiShouReportDailyMaterial> implements IKuaiShouReportDailyMaterialService {
     @Autowired
     private KuaiShouReportDailyMaterialMapper dailyMaterialMapper;
+    @Autowired
+    private KuaiShouReportHourlyMaterialMapper hourlyMaterialMapper;
 
     @Override
     public List<KuaiShouVideoGetVo> getVideoList(Map<String, Object> requestMap) {
@@ -44,7 +47,7 @@ public class KuaiShouReportDailyMaterialServiceImpl extends ServiceImpl<KuaiShou
      * @param endDate
      */
     @Override
-    public void getMaterialReportByAccountIdAndStatDate(Long accountId, String token, String startDate, String endDate, Integer page) {
+    public void getMaterialReportByAccountIdAndStatDate(Long accountId, String token, String startDate, String endDate, String temporalGranularity, Integer page) {
         String url = "https://ad.e.kuaishou.com/rest/openapi/v1/report/material_report";
         Map<String, String> headers = new HashMap<>();
         headers.put("Content-Type", "application/json");
@@ -53,7 +56,7 @@ public class KuaiShouReportDailyMaterialServiceImpl extends ServiceImpl<KuaiShou
         param.put("start_date", startDate);
         param.put("end_date", endDate);
         param.put("advertiser_id", accountId);
-        param.put("temporal_granularity", "DAILY");
+        param.put("temporal_granularity", temporalGranularity);
         param.put("view_type", 5);
         param.put("page_size", 2000);
         param.put("page", page);
@@ -89,11 +92,17 @@ public class KuaiShouReportDailyMaterialServiceImpl extends ServiceImpl<KuaiShou
             addList.add(material);
         }
         addList = this.getVideoInfoByList(addList, photoIdList);
-        dailyMaterialMapper.batchReplace(addList);
-        getMaterialReportByAccountIdAndStatDate(accountId, token, startDate, endDate, page + 1);
+        if ("DAILY".equals(temporalGranularity)) {
+            dailyMaterialMapper.batchReplace(addList);
+        } else if ("HOURLY".equals(temporalGranularity)) {
+            hourlyMaterialMapper.batchReplace(addList);
+        }
+
+        getMaterialReportByAccountIdAndStatDate(accountId, token, startDate, endDate, temporalGranularity, page + 1);
     }
 
-    private List<KuaiShouReportDailyMaterial> getVideoInfoByList(List<KuaiShouReportDailyMaterial> addList, List<Long> photoIdList) {
+    @Override
+    public List<KuaiShouReportDailyMaterial> getVideoInfoByList(List<KuaiShouReportDailyMaterial> addList, List<Long> photoIdList) {
         if (Check.isNull(photoIdList)) {
             return null;
         }

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

@@ -617,6 +617,8 @@ public class KuaiShouUpdateServiceImpl implements IKuaiShouUpdateService {
             Map<String, String> headers = new HashMap<>();
             headers.put("Access-Token", accessToken);
             headers.put("Content-Type", "application/json");
+            System.err.println("修改广告组入参:" + unitJson);
+            System.err.println("修改广告组head:" + headers);
             String result = HttpUtils.kuaiShouhttpPostRequest(url, unitJson.toJSONString(), headers);
             JSONObject resultJson = JSONObject.parseObject(result);
             log.info("修改广告组返回信息:{}", resultJson);

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

@@ -564,57 +564,6 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
 
 
     @Override
-    public void getAdvertiserGroupReportHourly(CtopOauthToken token, Date startDate, Date endDate) {
-        getGroupHourlyReportByPage(token, startDate, endDate, 1);
-    }
-
-    private void getGroupHourlyReportByPage(CtopOauthToken token, Date startDate, Date endDate, int page) {
-        String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.GTOUP_REPORT;
-        Map<String, String> headers = new HashMap<>();
-        headers.put("Content-Type", "application/json");
-        headers.put("Access-Token", token.getAccessToken());
-        Map<String, Object> param = new HashMap<>();
-        param.put("start_date", DateUtils.formatDate(startDate));
-        param.put("end_date", DateUtils.formatDate(endDate));
-        param.put("advertiser_id", token.getAccountId());
-        param.put("temporal_granularity", "HOURLY");
-        param.put("page_size", 2000);
-        param.put("page", page);
-
-        String result = HttpUtils.httpPostRequest(url, param, headers);
-        JSONObject resultJson = JSONObject.parseObject(result);
-        Integer code = resultJson.getInteger("code");
-        String message = resultJson.getString("message");
-        if (null == code || code != 0) {
-            log.error("获取快手广告组时报表异常:{},accountId:{}", message, token.getAccountId());
-            return;
-        }
-        JSONArray details = resultJson.getJSONObject("data").getJSONArray("details");
-        if (null == details || details.size() <= 0) {
-            log.info("快手广告组时报表信息为空=》accountId:{}", token.getAccountId());
-            return;
-        }
-        List<KuaishouReportHourlyGroup> groups = new ArrayList<>();
-        for (int i = 0; i < details.size(); i++) {
-            JSONObject detailJson = details.getJSONObject(i);
-            var show = detailJson.getLong("show");
-            detailJson.put("photo_show", show);
-            var like = detailJson.getLong("like");
-            detailJson.put("photo_like", like);
-            var hourlyGroup = JSONObject.toJavaObject(detailJson, KuaishouReportHourlyGroup.class);
-            hourlyGroup.setAccountId(token.getAccountId());
-            hourlyGroup.setId("" + hourlyGroup.getAccountId() + hourlyGroup.getUnitId() + hourlyGroup.getStatDate() + hourlyGroup.getStatHour());
-            hourlyGroup.setCreateTime(new Date());
-            hourlyGroup.setUpdateTime(new Date());
-            groups.add(hourlyGroup);
-        }
-        hourlyGroupService.replaceBatch(groups);
-
-
-        getGroupHourlyReportByPage(token, startDate, endDate, page + 1);
-    }
-
-    @Override
     public KuaishouResult<KuaishouReportHourlyGroup> getGroupHourlyReport(String accessToken, Long advertiserId, String startDate, String endDate, int pageSize, int pageNum) {
         String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.GTOUP_REPORT;
         Map<String, String> headers = new HashMap<>();
@@ -902,18 +851,10 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
         getGroupList(token, null, null);
         //获取全量创意数据
         getCreativeList(token, null, null);
-        //获取全量视频素材数据
-
-        //获取图片信息数据
-
-
         getAppList(token.getAccountId(), token.getAccessToken());
-
         log.info("----------------开始历史数据获取,accountId:{}", token.getAccountId());
-
         String endDateStr = DateUtils.getDate("yyyy-MM-dd");
-        String startDate = DateUtils.addMonth(endDateStr, -6);
-
+        String startDate = DateUtils.addMonth(endDateStr, -1);
         historyReportTaskService.createTask(token.getAccountId(), token.getAccessToken(), startDate, endDateStr, CtopAdConstant.KUAISHOU_LOAD_JOB_TYPE_HISTORY);
         getVideoList(token, null, null);
         //   getSuZaoList(token.getAccessToken(), token.getAccountId(), 1, null, null);
@@ -1994,7 +1935,10 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
                         returnJson.put("isAppInvoked", dataJson.getInteger("is_app_invoked"));
                         returnJson.put("isMultiConversion", dataJson.getInteger("is_multi_conversion"));
                         returnJson.put("isAdWatchTimes", dataJson.getInteger("is_ad_watch_times"));
-
+                        returnJson.put("isAppInvoked", dataJson.getInteger("is_app_invoked"));
+                        returnJson.put("isMultiConversion", dataJson.getInteger("is_multi_conversion"));
+                        returnJson.put("isAdWatchTimes", dataJson.getInteger("is_ad_watch_times"));
+                        returnJson.put("isOrderPaied", dataJson.getInteger("is_order_paied"));
 
                         JSONArray deep_conversion_types = dataJson.getJSONArray("deep_conversion_types");
                         JSONArray deepConversionTypes = new JSONArray();
@@ -3362,4 +3306,35 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
     }
 
 
+    @Override
+    public JSONArray getAppNames(Long accountId, String accessToken, JSONArray appIds) {
+        String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.APP_NAME;
+        Map<String, String> headers = new HashMap<>();
+        headers.put("Access-Token", accessToken);
+        headers.put("Content-Type", " application/json");
+        JSONObject json = new JSONObject();
+        json.put("advertiser_id", accountId);
+        json.put("type", 1);
+        json.put("ids", appIds);
+        String result = HttpUtils.kuaiShouhttpPostRequest(url, json.toJSONString(), headers);
+        JSONObject resultJson = JSONObject.parseObject(result);
+        if (!Check.isNull(resultJson)) {
+            Integer code = resultJson.getInteger("code");
+            if (code == 0) {
+                JSONObject data = resultJson.getJSONObject("data");
+                if (!Check.isNull(data)) {
+                    JSONArray keyword = data.getJSONArray("keyword");
+                    if (!Check.isNull(keyword)) {
+                        return keyword;
+
+                    }
+                }
+            }
+
+        }
+        return new JSONArray();
+
+    }
+
+
 }

+ 129 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/EtlKuaishouReportAccountHourlyController.java

@@ -1,6 +1,7 @@
 package cn.com.ctop.kuaishou.modules.report.controller;
 
 import cn.com.ctop.common.module.annotation.AutoLog;
+import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.QueryGenerator;
 import cn.com.ctop.kuaishou.modules.report.entity.EtlKuaishouReportAccountHourly;
 import cn.com.ctop.kuaishou.modules.report.service.IEtlKuaishouReportAccountHourlyService;
@@ -96,6 +97,134 @@ public class EtlKuaishouReportAccountHourlyController {
 
 
     /**
+     * 盯盘——运营个人绩效
+     *
+     * @param
+     * @return org.jeecg.common.api.vo.Result<java.lang.Object>
+     * @throws
+     * @author ZHAOXA
+     */
+    @GetMapping(value = "/personalAchievements")
+    public Result<Object> personalAchievements(String userId) {
+        try {
+            if (Check.isNull(userId)) {
+                return Result.error("缺少参数");
+            }
+            return etlKuaishouReportAccountHourlyService.queryPersonalAchievements(userId);
+        } catch (Exception e) {
+            log.error("error:", e.getMessage());
+            e.printStackTrace();
+        }
+        return Result.error("error");
+    }
+
+    /**
+     * 判断角色
+     *
+     * @param
+     * @return org.jeecg.common.api.vo.Result<java.lang.Object>
+     * @throws
+     * @author ZHAOXA
+     */
+    @GetMapping(value = "/checkRole")
+    public Result<Object> checkRole(String userId) {
+        try {
+            if (Check.isNull(userId)) {
+                return Result.error("缺少参数");
+            }
+            return etlKuaishouReportAccountHourlyService.checkRole(userId);
+        } catch (Exception e) {
+            log.error("error:", e.getMessage());
+            e.printStackTrace();
+        }
+        return Result.error("error");
+    }
+
+    /**
+     * 个人账户列表
+     *
+     * @param request
+     * @return
+     */
+    @PostMapping(value = "/accountPageList")
+    public Result<Object> accountPageList(@RequestBody JSONObject request) {
+        try {
+            return etlKuaishouReportAccountHourlyService.accountPageList(request);
+        } catch (Exception e) {
+            log.error("查询异常,", e.getMessage());
+            e.printStackTrace();
+        }
+        return Result.error("查询失败");
+    }
+    /**
+     * 经理账户列表
+     *
+     * @param request
+     * @return
+     */
+    @PostMapping(value = "/leaderAccountPageList")
+    public Result<Object> leaderAccountPageList(@RequestBody JSONObject request) {
+        try {
+            return etlKuaishouReportAccountHourlyService.leaderAccountPageList(request);
+        } catch (Exception e) {
+            log.error("查询异常,", e.getMessage());
+            e.printStackTrace();
+        }
+        return Result.error("查询失败");
+    }
+
+     /**
+     * 趋势图
+     *
+     * @param request
+     * @return
+     */
+    @PostMapping(value = "/queryNewlyData")
+    public Result<Object> queryNewlyData(@RequestBody JSONObject request) {
+        try {
+            return etlKuaishouReportAccountHourlyService.queryNewlyData(request);
+        } catch (Exception e) {
+            log.error("查询异常,", e.getMessage());
+            e.printStackTrace();
+        }
+        return Result.error("查询失败");
+    }
+
+     /**
+     * 运营人员当日数据列表
+     *
+     * @param request
+     * @return
+     */
+    @RequestMapping(value = "/operatingStaffDataList")
+    public Result<Object> operatingStaffDataList(@RequestBody JSONObject request) {
+        try {
+            return etlKuaishouReportAccountHourlyService.operatingStaffDataList(request);
+        } catch (Exception e) {
+            log.error("查询异常,", e.getMessage());
+            e.printStackTrace();
+        }
+        return Result.error("查询失败");
+    }
+
+     /**
+     * 项目列表
+     *
+     * @param request
+     * @return
+     */
+    @RequestMapping(value = "/projectList")
+    public Result<Object> projectList(@RequestBody JSONObject request) {
+        try {
+            return etlKuaishouReportAccountHourlyService.projectList(request);
+        } catch (Exception e) {
+            log.error("查询异常,", e.getMessage());
+            e.printStackTrace();
+        }
+        return Result.error("查询失败");
+    }
+
+    /**
      * 获取当日花费最大的账户
      *
      * @param

+ 248 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/KuaiShouProjectDataController.java

@@ -0,0 +1,248 @@
+package cn.com.ctop.kuaishou.modules.report.controller;
+
+import cn.com.ctop.common.module.annotation.AutoLog;
+import cn.com.ctop.common.module.utils.QueryGenerator;
+import cn.com.ctop.kuaishou.modules.report.entity.KuaiShouProjectData;
+import cn.com.ctop.kuaishou.modules.report.service.IKuaiShouProjectDataService;
+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-04-20
+ */
+@Slf4j
+@Api(tags = "快手-配置项目拉取时报数据")
+@RestController
+@RequestMapping("/project/kuaiShouProjectData")
+public class KuaiShouProjectDataController {
+    @Autowired
+    private IKuaiShouProjectDataService kuaiShouProjectDataService;
+
+    /**
+     * 分页列表查询
+     *
+     * @param kuaiShouProjectData
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @AutoLog(value = "快手-配置项目拉取时报数据-分页列表查询")
+    @ApiOperation(value = "快手-配置项目拉取时报数据-分页列表查询", notes = "快手-配置项目拉取时报数据-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<IPage<KuaiShouProjectData>> queryPageList(KuaiShouProjectData kuaiShouProjectData,
+                                                            @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                            @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                            HttpServletRequest req) {
+        Result<IPage<KuaiShouProjectData>> result = new Result<>();
+        QueryWrapper<KuaiShouProjectData> queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouProjectData, req.getParameterMap());
+        Page<KuaiShouProjectData> page = new Page<KuaiShouProjectData>(pageNo, pageSize);
+        IPage<KuaiShouProjectData> pageList = kuaiShouProjectDataService.page(page, queryWrapper);
+        result.setSuccess(true);
+        result.setResult(pageList);
+        return result;
+    }
+
+    /**
+     * 添加
+     *
+     * @param kuaiShouProjectData
+     * @return
+     */
+    @AutoLog(value = "快手-配置项目拉取时报数据-添加")
+    @ApiOperation(value = "快手-配置项目拉取时报数据-添加", notes = "快手-配置项目拉取时报数据-添加")
+    @PostMapping(value = "/add")
+    public Result<KuaiShouProjectData> add(@RequestBody KuaiShouProjectData kuaiShouProjectData) {
+        Result<KuaiShouProjectData> result = new Result<>();
+        try {
+            kuaiShouProjectDataService.save(kuaiShouProjectData);
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+
+    /**
+     * 编辑
+     *
+     * @param kuaiShouProjectData
+     * @return
+     */
+    @AutoLog(value = "快手-配置项目拉取时报数据-编辑")
+    @ApiOperation(value = "快手-配置项目拉取时报数据-编辑", notes = "快手-配置项目拉取时报数据-编辑")
+    @PutMapping(value = "/edit")
+    public Result<KuaiShouProjectData> edit(@RequestBody KuaiShouProjectData kuaiShouProjectData) {
+        Result<KuaiShouProjectData> result = new Result<KuaiShouProjectData>();
+        KuaiShouProjectData kuaiShouProjectDataEntity = kuaiShouProjectDataService.getById(kuaiShouProjectData.getId());
+        if (kuaiShouProjectDataEntity == null) {
+            result.error500("未找到对应实体");
+        } else {
+            boolean ok = kuaiShouProjectDataService.updateById(kuaiShouProjectData);
+            if (ok) {
+                result.success("修改成功!");
+            }
+        }
+
+        return result;
+    }
+
+    /**
+     * 通过id删除
+     *
+     * @param id
+     * @return
+     */
+    @AutoLog(value = "快手-配置项目拉取时报数据-通过id删除")
+    @ApiOperation(value = "快手-配置项目拉取时报数据-通过id删除", notes = "快手-配置项目拉取时报数据-通过id删除")
+    @DeleteMapping(value = "/delete")
+    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+        try {
+            kuaiShouProjectDataService.removeById(id);
+        } catch (Exception e) {
+            log.error("删除失败", e.getMessage());
+            return Result.error("删除失败!");
+        }
+        return Result.ok("删除成功!");
+    }
+
+    /**
+     * 批量删除
+     *
+     * @param ids
+     * @return
+     */
+    @AutoLog(value = "快手-配置项目拉取时报数据-批量删除")
+    @ApiOperation(value = "快手-配置项目拉取时报数据-批量删除", notes = "快手-配置项目拉取时报数据-批量删除")
+    @DeleteMapping(value = "/deleteBatch")
+    public Result<KuaiShouProjectData> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
+        Result<KuaiShouProjectData> result = new Result<>();
+        if (ids == null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        } else {
+            this.kuaiShouProjectDataService.removeByIds(Arrays.asList(ids.split(",")));
+            result.success("删除成功!");
+        }
+        return result;
+    }
+
+    /**
+     * 通过id查询
+     *
+     * @param id
+     * @return
+     */
+    @AutoLog(value = "快手-配置项目拉取时报数据-通过id查询")
+    @ApiOperation(value = "快手-配置项目拉取时报数据-通过id查询", notes = "快手-配置项目拉取时报数据-通过id查询")
+    @GetMapping(value = "/queryById")
+    public Result<KuaiShouProjectData> queryById(@RequestParam(name = "id", required = true) String id) {
+        Result<KuaiShouProjectData> result = new Result<>();
+        KuaiShouProjectData kuaiShouProjectData = kuaiShouProjectDataService.getById(id);
+        if (kuaiShouProjectData == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(kuaiShouProjectData);
+            result.setSuccess(true);
+        }
+        return result;
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param response
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+        // Step.1 组装查询条件
+        QueryWrapper<KuaiShouProjectData> queryWrapper = null;
+        try {
+            String paramsStr = request.getParameter("paramsStr");
+            if (oConvertUtils.isNotEmpty(paramsStr)) {
+                String deString = URLDecoder.decode(paramsStr, "UTF-8");
+                KuaiShouProjectData kuaiShouProjectData = JSON.parseObject(deString, KuaiShouProjectData.class);
+                queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouProjectData, request.getParameterMap());
+            }
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+
+        //Step.2 AutoPoi 导出Excel
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        List<KuaiShouProjectData> pageList = kuaiShouProjectDataService.list(queryWrapper);
+        //导出文件名称
+        mv.addObject(NormalExcelConstants.FILE_NAME, "快手-配置项目拉取时报数据列表");
+        mv.addObject(NormalExcelConstants.CLASS, KuaiShouProjectData.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<KuaiShouProjectData> listKuaiShouProjectDatas = ExcelImportUtil.importExcel(file.getInputStream(), KuaiShouProjectData.class, params);
+                kuaiShouProjectDataService.saveBatch(listKuaiShouProjectDatas);
+                return Result.ok("文件导入成功!数据行数:" + listKuaiShouProjectDatas.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("文件导入失败!");
+    }
+
+}

+ 248 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/KuaiShouReportHourlyMaterialController.java

@@ -0,0 +1,248 @@
+package cn.com.ctop.kuaishou.modules.report.controller;
+
+import cn.com.ctop.common.module.annotation.AutoLog;
+import cn.com.ctop.common.module.utils.QueryGenerator;
+import cn.com.ctop.kuaishou.modules.report.entity.KuaiShouReportHourlyMaterial;
+import cn.com.ctop.kuaishou.modules.report.service.IKuaiShouReportHourlyMaterialService;
+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-04-20
+ */
+@Slf4j
+@Api(tags = "素材时报")
+@RestController
+@RequestMapping("/kuaishou/kuaiShouReportHourlyMaterial")
+public class KuaiShouReportHourlyMaterialController {
+    @Autowired
+    private IKuaiShouReportHourlyMaterialService kuaiShouReportHourlyMaterialService;
+
+    /**
+     * 分页列表查询
+     *
+     * @param kuaiShouReportHourlyMaterial
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @AutoLog(value = "素材时报-分页列表查询")
+    @ApiOperation(value = "素材时报-分页列表查询", notes = "素材时报-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<IPage<KuaiShouReportHourlyMaterial>> queryPageList(KuaiShouReportHourlyMaterial kuaiShouReportHourlyMaterial,
+                                                                     @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                                     @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                                     HttpServletRequest req) {
+        Result<IPage<KuaiShouReportHourlyMaterial>> result = new Result<>();
+        QueryWrapper<KuaiShouReportHourlyMaterial> queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouReportHourlyMaterial, req.getParameterMap());
+        Page<KuaiShouReportHourlyMaterial> page = new Page<KuaiShouReportHourlyMaterial>(pageNo, pageSize);
+        IPage<KuaiShouReportHourlyMaterial> pageList = kuaiShouReportHourlyMaterialService.page(page, queryWrapper);
+        result.setSuccess(true);
+        result.setResult(pageList);
+        return result;
+    }
+
+    /**
+     * 添加
+     *
+     * @param kuaiShouReportHourlyMaterial
+     * @return
+     */
+    @AutoLog(value = "素材时报-添加")
+    @ApiOperation(value = "素材时报-添加", notes = "素材时报-添加")
+    @PostMapping(value = "/add")
+    public Result<KuaiShouReportHourlyMaterial> add(@RequestBody KuaiShouReportHourlyMaterial kuaiShouReportHourlyMaterial) {
+        Result<KuaiShouReportHourlyMaterial> result = new Result<>();
+        try {
+            kuaiShouReportHourlyMaterialService.save(kuaiShouReportHourlyMaterial);
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+
+    /**
+     * 编辑
+     *
+     * @param kuaiShouReportHourlyMaterial
+     * @return
+     */
+    @AutoLog(value = "素材时报-编辑")
+    @ApiOperation(value = "素材时报-编辑", notes = "素材时报-编辑")
+    @PutMapping(value = "/edit")
+    public Result<KuaiShouReportHourlyMaterial> edit(@RequestBody KuaiShouReportHourlyMaterial kuaiShouReportHourlyMaterial) {
+        Result<KuaiShouReportHourlyMaterial> result = new Result<KuaiShouReportHourlyMaterial>();
+        KuaiShouReportHourlyMaterial kuaiShouReportHourlyMaterialEntity = kuaiShouReportHourlyMaterialService.getById(kuaiShouReportHourlyMaterial.getId());
+        if (kuaiShouReportHourlyMaterialEntity == null) {
+            result.error500("未找到对应实体");
+        } else {
+            boolean ok = kuaiShouReportHourlyMaterialService.updateById(kuaiShouReportHourlyMaterial);
+            if (ok) {
+                result.success("修改成功!");
+            }
+        }
+
+        return result;
+    }
+
+    /**
+     * 通过id删除
+     *
+     * @param id
+     * @return
+     */
+    @AutoLog(value = "素材时报-通过id删除")
+    @ApiOperation(value = "素材时报-通过id删除", notes = "素材时报-通过id删除")
+    @DeleteMapping(value = "/delete")
+    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+        try {
+            kuaiShouReportHourlyMaterialService.removeById(id);
+        } catch (Exception e) {
+            log.error("删除失败", e.getMessage());
+            return Result.error("删除失败!");
+        }
+        return Result.ok("删除成功!");
+    }
+
+    /**
+     * 批量删除
+     *
+     * @param ids
+     * @return
+     */
+    @AutoLog(value = "素材时报-批量删除")
+    @ApiOperation(value = "素材时报-批量删除", notes = "素材时报-批量删除")
+    @DeleteMapping(value = "/deleteBatch")
+    public Result<KuaiShouReportHourlyMaterial> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
+        Result<KuaiShouReportHourlyMaterial> result = new Result<>();
+        if (ids == null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        } else {
+            this.kuaiShouReportHourlyMaterialService.removeByIds(Arrays.asList(ids.split(",")));
+            result.success("删除成功!");
+        }
+        return result;
+    }
+
+    /**
+     * 通过id查询
+     *
+     * @param id
+     * @return
+     */
+    @AutoLog(value = "素材时报-通过id查询")
+    @ApiOperation(value = "素材时报-通过id查询", notes = "素材时报-通过id查询")
+    @GetMapping(value = "/queryById")
+    public Result<KuaiShouReportHourlyMaterial> queryById(@RequestParam(name = "id", required = true) String id) {
+        Result<KuaiShouReportHourlyMaterial> result = new Result<>();
+        KuaiShouReportHourlyMaterial kuaiShouReportHourlyMaterial = kuaiShouReportHourlyMaterialService.getById(id);
+        if (kuaiShouReportHourlyMaterial == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(kuaiShouReportHourlyMaterial);
+            result.setSuccess(true);
+        }
+        return result;
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param response
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+        // Step.1 组装查询条件
+        QueryWrapper<KuaiShouReportHourlyMaterial> queryWrapper = null;
+        try {
+            String paramsStr = request.getParameter("paramsStr");
+            if (oConvertUtils.isNotEmpty(paramsStr)) {
+                String deString = URLDecoder.decode(paramsStr, "UTF-8");
+                KuaiShouReportHourlyMaterial kuaiShouReportHourlyMaterial = JSON.parseObject(deString, KuaiShouReportHourlyMaterial.class);
+                queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouReportHourlyMaterial, request.getParameterMap());
+            }
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+
+        //Step.2 AutoPoi 导出Excel
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        List<KuaiShouReportHourlyMaterial> pageList = kuaiShouReportHourlyMaterialService.list(queryWrapper);
+        //导出文件名称
+        mv.addObject(NormalExcelConstants.FILE_NAME, "素材时报列表");
+        mv.addObject(NormalExcelConstants.CLASS, KuaiShouReportHourlyMaterial.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<KuaiShouReportHourlyMaterial> listKuaiShouReportHourlyMaterials = ExcelImportUtil.importExcel(file.getInputStream(), KuaiShouReportHourlyMaterial.class, params);
+                kuaiShouReportHourlyMaterialService.saveBatch(listKuaiShouReportHourlyMaterials);
+                return Result.ok("文件导入成功!数据行数:" + listKuaiShouReportHourlyMaterials.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("文件导入失败!");
+    }
+
+}

+ 15 - 9
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/EtlKuaishouReportAccountHourly.java

@@ -1,21 +1,20 @@
 package cn.com.ctop.kuaishou.modules.report.entity;
 
-import java.io.Serializable;
-import java.math.BigDecimal;
-import java.util.Date;
-
 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 com.baomidou.mybatisplus.annotation.TableField;
+import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
-import com.fasterxml.jackson.annotation.JsonFormat;
-import org.springframework.format.annotation.DateTimeFormat;
 import org.jeecgframework.poi.excel.annotation.Excel;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.math.BigDecimal;
+import java.util.Date;
 
 /**
  * 账户维度-每小时盯盘数据
@@ -223,7 +222,8 @@ public class EtlKuaishouReportAccountHourly {
     @Excel(name = "落地页数据-落地页授信数", width = 15)
     @ApiModelProperty(value = "落地页数据-落地页授信数")
     private Long eventCreditGrantLandingPage;
-    /**Save pv the next day
+    /**
+     * Save pv the next day
      * 应用下载数据-次留数(仅支持分日查询)
      */
     @Excel(name = "应用下载数据-次留数(仅支持分日查询)", width = 15)
@@ -259,6 +259,12 @@ public class EtlKuaishouReportAccountHourly {
     private Date updateTime;
 
     @TableField(exist = false)
+    private BigDecimal totalBalance;//余额
+    @TableField(exist = false)
+    private BigDecimal budget;//预算
+    @TableField(exist = false)
+    private String authName;//账户名称
+    @TableField(exist = false)
     private BigDecimal activationCost;//激活单价
     @TableField(exist = false)
     private BigDecimal impression1kCost;//平均千次素材曝光花费 = 花费/素材曝光数*1000
@@ -318,5 +324,5 @@ public class EtlKuaishouReportAccountHourly {
     private BigDecimal formActionRatio;//表单提交点击率 =当日回传表单数/当日行为数
     @TableField(exist = false)
     private BigDecimal submitRatio;//按钮点击率 =当日按钮点击数 / 当日行为数
-    private BigDecimal grew=new BigDecimal(0);//同比 = (今日实时花费-昨日截止到此时的花费)/昨日截止到此时的花费*100%;
+    private BigDecimal grew = new BigDecimal(0);//同比 = (今日实时花费-昨日截止到此时的花费)/昨日截止到此时的花费*100%;
 }

+ 71 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/KuaiShouProjectData.java

@@ -0,0 +1,71 @@
+package cn.com.ctop.kuaishou.modules.report.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import org.jeecgframework.poi.excel.annotation.Excel;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
+
+/**
+ * 快手-配置项目拉取时报数据
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2021-04-20
+ */
+@Data
+@TableName("ctop_kuaishou_project_data")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_kuaishou_project_data对象", description = "快手-配置项目拉取时报数据")
+public class KuaiShouProjectData {
+
+    /**
+     * id
+     */
+    @TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "id")
+    private Long id;
+    /**
+     * 账户ID
+     */
+    @Excel(name = "账户ID", width = 15)
+    @ApiModelProperty(value = "账户ID")
+    private Long projectId;
+    /**
+     * 项目名称
+     */
+    @Excel(name = "项目名称", width = 15)
+    @ApiModelProperty(value = "项目名称")
+    private String projectName;
+    /**
+     * 0:拉取 1:暂停
+     */
+    @Excel(name = "0:拉取 1:暂停", width = 15)
+    @ApiModelProperty(value = "0:拉取 1:暂停")
+    private Integer projectStatus;
+    /**
+     * 创建时间
+     */
+    @Excel(name = "创建时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "创建时间")
+    private Date createTime;
+    /**
+     * 修改时间
+     */
+    @Excel(name = "修改时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "修改时间")
+    private Date updateTime;
+}

+ 2 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/KuaiShouReportDailyMaterial.java

@@ -1,6 +1,7 @@
 package cn.com.ctop.kuaishou.modules.report.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 com.fasterxml.jackson.annotation.JsonFormat;
@@ -11,7 +12,6 @@ import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
 import org.jeecgframework.poi.excel.annotation.Excel;
 import org.springframework.format.annotation.DateTimeFormat;
-import com.baomidou.mybatisplus.annotation.TableField;
 
 import java.util.Date;
 
@@ -191,6 +191,7 @@ public class KuaiShouReportDailyMaterial {
     @Excel(name = "日期", width = 15)
     @ApiModelProperty(value = "日期")
     private String statDate;
+    private Integer statHour;
     /**
      * 封面点击数
      */

+ 425 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/KuaiShouReportHourlyMaterial.java

@@ -0,0 +1,425 @@
+package cn.com.ctop.kuaishou.modules.report.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import org.jeecgframework.poi.excel.annotation.Excel;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
+
+/**
+ * 素材时报
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2021-04-20
+ */
+@Data
+@TableName("ctop_kuaishou_report_hourly_material")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_kuaishou_report_hourly_material对象", description = "素材时报")
+public class KuaiShouReportHourlyMaterial {
+
+    /**
+     * id
+     */
+    @TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "id")
+    private Long id;
+    /**
+     * 账户ID
+     */
+    @Excel(name = "账户ID", width = 15)
+    @ApiModelProperty(value = "账户ID")
+    private Long accountId;
+    /**
+     * 计划ID
+     */
+    @Excel(name = "计划ID", width = 15)
+    @ApiModelProperty(value = "计划ID")
+    private Long photoId;
+    /**
+     * channelType
+     */
+    @Excel(name = "channelType", width = 15)
+    @ApiModelProperty(value = "channelType")
+    private Integer channelType;
+    /**
+     * signature
+     */
+    @Excel(name = "signature", width = 15)
+    @ApiModelProperty(value = "signature")
+    private String signature;
+    /**
+     * 封面token
+     */
+    @Excel(name = "封面token", width = 15)
+    @ApiModelProperty(value = "封面token")
+    private String imageToken;
+    /**
+     * 封面url
+     */
+    @Excel(name = "封面url", width = 15)
+    @ApiModelProperty(value = "封面url")
+    private String coverUrl;
+    /**
+     * 视频uel
+     */
+    @Excel(name = "视频uel", width = 15)
+    @ApiModelProperty(value = "视频uel")
+    private String photoUrl;
+    /**
+     * 素材类型
+     */
+    @Excel(name = "素材类型", width = 15)
+    @ApiModelProperty(value = "素材类型")
+    private String creativeMaterialTypeString;
+    /**
+     * 场景
+     */
+    @Excel(name = "场景", width = 15)
+    @ApiModelProperty(value = "场景")
+    private String adScene;
+    /**
+     * 花费(元)
+     */
+    @Excel(name = "花费(元)", width = 15)
+    @ApiModelProperty(value = "花费(元)")
+    private java.math.BigDecimal charge;
+    /**
+     * 曝光数
+     */
+    @Excel(name = "曝光数", width = 15)
+    @ApiModelProperty(value = "曝光数")
+    private Integer photoShow;
+    /**
+     * 素材曝光数
+     */
+    @Excel(name = "素材曝光数", width = 15)
+    @ApiModelProperty(value = "素材曝光数")
+    private Integer aclick;
+    /**
+     * 行为数
+     */
+    @Excel(name = "行为数", width = 15)
+    @ApiModelProperty(value = "行为数")
+    private Integer bclick;
+    /**
+     * 分享数
+     */
+    @Excel(name = "分享数", width = 15)
+    @ApiModelProperty(value = "分享数")
+    private Integer photoShare;
+    /**
+     * 评论数
+     */
+    @Excel(name = "评论数", width = 15)
+    @ApiModelProperty(value = "评论数")
+    private Integer photoComment;
+    /**
+     * 点赞数
+     */
+    @Excel(name = "点赞数", width = 15)
+    @ApiModelProperty(value = "点赞数")
+    private Integer photoLike;
+    /**
+     * 新增关注数
+     */
+    @Excel(name = "新增关注数", width = 15)
+    @ApiModelProperty(value = "新增关注数")
+    private Integer follow;
+    /**
+     * 取消关注数
+     */
+    @Excel(name = "取消关注数", width = 15)
+    @ApiModelProperty(value = "取消关注数")
+    private Integer cancelFollow;
+    /**
+     * 举报数
+     */
+    @Excel(name = "举报数", width = 15)
+    @ApiModelProperty(value = "举报数")
+    private Integer report;
+    /**
+     * 拉黑数
+     */
+    @Excel(name = "拉黑数", width = 15)
+    @ApiModelProperty(value = "拉黑数")
+    private Integer block;
+    /**
+     * 减少此类作品数
+     */
+    @Excel(name = "减少此类作品数", width = 15)
+    @ApiModelProperty(value = "减少此类作品数")
+    private Integer negative;
+    /**
+     * 应用下载数据-安卓下载开始数
+     */
+    @Excel(name = "应用下载数据-安卓下载开始数", width = 15)
+    @ApiModelProperty(value = "应用下载数据-安卓下载开始数")
+    private Integer downloadStarted;
+    /**
+     * 应用下载数据-安卓下载完成数
+     */
+    @Excel(name = "应用下载数据-安卓下载完成数", width = 15)
+    @ApiModelProperty(value = "应用下载数据-安卓下载完成数")
+    private Integer downloadCompleted;
+    /**
+     * 应用下载数据-激活数
+     */
+    @Excel(name = "应用下载数据-激活数", width = 15)
+    @ApiModelProperty(value = "应用下载数据-激活数")
+    private Integer activation;
+    /**
+     * 提交按钮点击数
+     */
+    @Excel(name = "提交按钮点击数", width = 15)
+    @ApiModelProperty(value = "提交按钮点击数")
+    private Integer submit;
+    /**
+     * 日期
+     */
+    @Excel(name = "日期", width = 15)
+    @ApiModelProperty(value = "日期")
+    private String statDate;
+    /**
+     * 时段
+     */
+    @Excel(name = "时段", width = 15)
+    @ApiModelProperty(value = "时段")
+    private Integer statHour;
+    /**
+     * 封面点击数
+     */
+    @Excel(name = "封面点击数", width = 15)
+    @ApiModelProperty(value = "封面点击数")
+    private Integer photoClick;
+    /**
+     * 封面点击率
+     */
+    @Excel(name = "封面点击率", width = 15)
+    @ApiModelProperty(value = "封面点击率")
+    private Double photoClickRatio;
+    /**
+     * 行为率
+     */
+    @Excel(name = "行为率", width = 15)
+    @ApiModelProperty(value = "行为率")
+    private Double actionRatio;
+    /**
+     * 平均千次曝光花费(元)
+     */
+    @Excel(name = "平均千次曝光花费(元)", width = 15)
+    @ApiModelProperty(value = "平均千次曝光花费(元)")
+    private java.math.BigDecimal impression1kCost;
+    /**
+     * 平均点击单价(元)
+     */
+    @Excel(name = "平均点击单价(元)", width = 15)
+    @ApiModelProperty(value = "平均点击单价(元)")
+    private java.math.BigDecimal photoClickCost;
+    /**
+     * 平均行为单价(元)
+     */
+    @Excel(name = "平均行为单价(元)", width = 15)
+    @ApiModelProperty(value = "平均行为单价(元)")
+    private java.math.BigDecimal actionCost;
+    /**
+     * 应用下载数据-首日付费次数
+     */
+    @Excel(name = "应用下载数据-首日付费次数", width = 15)
+    @ApiModelProperty(value = "应用下载数据-首日付费次数")
+    private Integer eventPayFirstDay;
+    /**
+     * 应用下载数据-首日付费金额
+     */
+    @Excel(name = "应用下载数据-首日付费金额", width = 15)
+    @ApiModelProperty(value = "应用下载数据-首日付费金额")
+    private java.math.BigDecimal eventPayPurchaseAmountFirstDay;
+    /**
+     * 应用下载数据-首日ROI
+     */
+    @Excel(name = "应用下载数据-首日ROI", width = 15)
+    @ApiModelProperty(value = "应用下载数据-首日ROI")
+    private Double eventPayFirstDayRoi;
+    /**
+     * 应用下载数据-付费次数
+     */
+    @Excel(name = "应用下载数据-付费次数", width = 15)
+    @ApiModelProperty(value = "应用下载数据-付费次数")
+    private Integer eventPay;
+    /**
+     * 应用下载数据-付费金额
+     */
+    @Excel(name = "应用下载数据-付费金额", width = 15)
+    @ApiModelProperty(value = "应用下载数据-付费金额")
+    private java.math.BigDecimal eventPayPurchaseAmount;
+    /**
+     * 应用下载数据-ROI
+     */
+    @Excel(name = "应用下载数据-ROI", width = 15)
+    @ApiModelProperty(value = "应用下载数据-ROI")
+    private Double eventPayRoi;
+    /**
+     * 应用下载数据-注册数
+     */
+    @Excel(name = "应用下载数据-注册数", width = 15)
+    @ApiModelProperty(value = "应用下载数据-注册数")
+    private Integer eventRegister;
+    /**
+     * 应用下载数据-注册成本
+     */
+    @Excel(name = "应用下载数据-注册成本", width = 15)
+    @ApiModelProperty(value = "应用下载数据-注册成本")
+    private java.math.BigDecimal eventRegisterCost;
+    /**
+     * 应用下载数据-注册率
+     */
+    @Excel(name = "应用下载数据-注册率", width = 15)
+    @ApiModelProperty(value = "应用下载数据-注册率")
+    private Double eventRegisterRatio;
+    /**
+     * 应用下载数据-完件数
+     */
+    @Excel(name = "应用下载数据-完件数", width = 15)
+    @ApiModelProperty(value = "应用下载数据-完件数")
+    private Integer eventJinJianApp;
+    /**
+     * 应用下载数据-完件成本
+     */
+    @Excel(name = "应用下载数据-完件成本", width = 15)
+    @ApiModelProperty(value = "应用下载数据-完件成本")
+    private java.math.BigDecimal eventJinJianAppCost;
+    /**
+     * 应用下载数据-授信数
+     */
+    @Excel(name = "应用下载数据-授信数", width = 15)
+    @ApiModelProperty(value = "应用下载数据-授信数")
+    private Integer eventCreditGrantApp;
+    /**
+     * 应用下载数据-授信成本
+     */
+    @Excel(name = "应用下载数据-授信成本", width = 15)
+    @ApiModelProperty(value = "应用下载数据-授信成本")
+    private java.math.BigDecimal eventCreditGrantAppCost;
+    /**
+     * 应用下载数据-授信率
+     */
+    @Excel(name = "应用下载数据-授信率", width = 15)
+    @ApiModelProperty(value = "应用下载数据-授信率")
+    private Double eventCreditGrantAppRatio;
+    /**
+     * 应用下载数据-付款成功数
+     */
+    @Excel(name = "应用下载数据-付款成功数", width = 15)
+    @ApiModelProperty(value = "应用下载数据-付款成功数")
+    private Integer eventOrderPaid;
+    /**
+     * 应用下载数据-付款成功金额
+     */
+    @Excel(name = "应用下载数据-付款成功金额", width = 15)
+    @ApiModelProperty(value = "应用下载数据-付款成功金额")
+    private java.math.BigDecimal eventOrderPaidPurchaseAmount;
+    /**
+     * 落地页数据-落地页完件数
+     */
+    @Excel(name = "落地页数据-落地页完件数", width = 15)
+    @ApiModelProperty(value = "落地页数据-落地页完件数")
+    private Integer eventJinJianLandingPage;
+    /**
+     * 落地页数据-落地页完件成本
+     */
+    @Excel(name = "落地页数据-落地页完件成本", width = 15)
+    @ApiModelProperty(value = "落地页数据-落地页完件成本")
+    private java.math.BigDecimal eventJinJianLandingPageCost;
+    /**
+     * 落地页数据-落地页授信数
+     */
+    @Excel(name = "落地页数据-落地页授信数", width = 15)
+    @ApiModelProperty(value = "落地页数据-落地页授信数")
+    private Integer eventCreditGrantLandingPage;
+    /**
+     * 落地页数据-落地页授信成本
+     */
+    @Excel(name = "落地页数据-落地页授信成本", width = 15)
+    @ApiModelProperty(value = "落地页数据-落地页授信成本")
+    private java.math.BigDecimal eventCreditGrantLandingPageCost;
+    /**
+     * 落地页数据-落地页授信率
+     */
+    @Excel(name = "落地页数据-落地页授信率", width = 15)
+    @ApiModelProperty(value = "落地页数据-落地页授信率")
+    private Double eventCreditGrantLandingRatio;
+    /**
+     * 应用下载数据-次留成本(仅支持分日查询)
+     */
+    @Excel(name = "应用下载数据-次留成本(仅支持分日查询)", width = 15)
+    @ApiModelProperty(value = "应用下载数据-次留成本(仅支持分日查询)")
+    private java.math.BigDecimal eventNextDayStayCost;
+    /**
+     * 应用下载数据-次留率(仅支持分日查询)
+     */
+    @Excel(name = "应用下载数据-次留率(仅支持分日查询)", width = 15)
+    @ApiModelProperty(value = "应用下载数据-次留率(仅支持分日查询)")
+    private Integer eventNextDayStayRatio;
+    /**
+     * 落地页数据-表单提交点击率
+     */
+    @Excel(name = "落地页数据-表单提交点击率", width = 15)
+    @ApiModelProperty(value = "落地页数据-表单提交点击率")
+    private Double formActionRatio;
+    /**
+     * 应用下载数据-单次付款成本
+     */
+    @Excel(name = "应用下载数据-单次付款成本", width = 15)
+    @ApiModelProperty(value = "应用下载数据-单次付款成本")
+    private java.math.BigDecimal eventOrderPaidCost;
+    /**
+     * 应用下载数据-次留数(仅支持分日查询)
+     */
+    @Excel(name = "应用下载数据-次留数(仅支持分日查询)", width = 15)
+    @ApiModelProperty(value = "应用下载数据-次留数(仅支持分日查询)")
+    private Integer eventNextDayStay;
+    /**
+     * 落地页数据-表单提交单价
+     */
+    @Excel(name = "落地页数据-表单提交单价", width = 15)
+    @ApiModelProperty(value = "落地页数据-表单提交单价")
+    private java.math.BigDecimal formCost;
+    /**
+     * 落地页数据-表单提交数
+     */
+    @Excel(name = "落地页数据-表单提交数", width = 15)
+    @ApiModelProperty(value = "落地页数据-表单提交数")
+    private Integer formCount;
+    /**
+     * 3s播放率
+     */
+    @Excel(name = "3s播放率", width = 15)
+    @ApiModelProperty(value = "3s播放率")
+    private Double play3sRatio;
+    /**
+     * 创建时间
+     */
+    @Excel(name = "创建时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "创建时间")
+    private Date createTime;
+    /**
+     * 修改时间
+     */
+    @Excel(name = "修改时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "修改时间")
+    private Date updateTime;
+}

+ 7 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/KuaishouReportDailyAccount.java

@@ -182,5 +182,12 @@ public class KuaishouReportDailyAccount implements Serializable {
     private Date createTime;
 
     private Date updateTime;
+
+    /**新增付费人数*/
+    private Long eventNewUserPay;
+    /**新增付费人数成本*/
+    private BigDecimal eventNewUserPayCost;
+    /**新增付费人数率*/
+    private BigDecimal eventNewUserPayRatio;
 }
 

+ 6 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/KuaishouReportHourlyAccount.java

@@ -126,7 +126,12 @@ public class KuaishouReportHourlyAccount implements Serializable {
     private Long negative;
     @JsonProperty
     private Long eventAppInvoked;
-
+    /**新增付费人数*/
+    private Long eventNewUserPay;
+    /**新增付费人数成本*/
+    private BigDecimal eventNewUserPayCost;
+    /**新增付费人数率*/
+    private BigDecimal eventNewUserPayRatio;
     @JsonProperty
     private Date createTime;
     @JsonProperty

+ 94 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/enums/CheckParametersCostEnum.java

@@ -0,0 +1,94 @@
+package cn.com.ctop.kuaishou.modules.report.enums;
+
+/**
+ * 运营盯盘 按字段排序枚举
+ *
+ * @param
+ * @author ZHAOXA
+ * @return
+ * @throws
+ */
+public enum CheckParametersCostEnum {
+    PARAMETER1("cost", "sum(t1.charge)"),
+    PARAMETER2("photoShow", "sum(t1.photo_show)"),
+    PARAMETER3("photoClick", "sum(t1.photo_click)"),
+    PARAMETER4("aClick", "sum(t1.aclick)"),
+    PARAMETER5("bClick", "sum(t1.bclick)"),
+    PARAMETER6("cpm", "sum(t1.charge) / sum(t1.photo_show)"),
+    PARAMETER7("cpc", "sum(t1.charge) / sum(t1.photo_click)"),
+    PARAMETER8("cpb", "sum(t1.charge) / sum(t1.bclick)"),
+    PARAMETER9("downloadStart", "sum(download_started)"),
+    PARAMETER10("downloadStartCost", "sum(t1.charge) / sum(t1.download_started)"),
+    PARAMETER11("downloadFinish", "sum(download_completed)"),
+    PARAMETER12("downloadFinishCost", "sum(t1.charge) / sum(t1.download_completed)"),
+    PARAMETER13("active", "sum(activation)"),
+    PARAMETER14("activeCost", "sum(t1.charge) / sum(t1.activation)"),
+    PARAMETER15("firstDayPay", "sum(t1.event_pay_first_day)"),
+    PARAMETER16("firstDayPayAmount", "sum(t1.event_pay_purchase_amount_first_day)"),
+    PARAMETER17("firstDayPayCost", "sum(t1.charge) / sum(t1.event_pay_first_day)"),
+    PARAMETER18("eventPay", "sum(t1.event_pay)"),
+    PARAMETER19("eventPayPurchaseAmount", "sum(t1.event_pay_purchase_amount)"),
+    PARAMETER20("eventPayCost", "sum(t1.charge) / sum(t1.event_pay)"),
+    PARAMETER21("register", "sum(t1.event_register)"),
+    PARAMETER22("activeRegisterCost", "sum(t1.charge)/sum(t1.event_register)"),
+    PARAMETER23("eventJinJianApp", "sum(event_jin_jian_app)"),
+    PARAMETER24("eventJinJianAppCost", "sum(t1.charge)/sum(t1.event_jin_jian_app)"),
+    PARAMETER25("eventCreditGrantApp", "sum(event_credit_grant_app)"),
+    PARAMETER26("eventCreditGrantAppCost", "sum(t1.charge)/sum(t1.event_credit_grant_app)"),
+    PARAMETER27("formCount", "sum(t1.form_count)"),
+    PARAMETER28("formCountCost", "sum(t1.charge)/sum(t1.form_count)"),
+    PARAMETER29("nextDayOpen", "sum(t1.event_next_day_stay)"),
+    PARAMETER30("nextDayOpenCost", "sum(t1.charge)/sum(t1.event_next_day_stay)"),
+    PARAMETER31("eventJinJianLandingPage", "sum(t1.event_jin_jian_landing_page)"),
+    PARAMETER32("eventJinJianLandingPageCost", "sum(t1.charge)/sum(t1.event_jin_jian_landing_page)"),
+    PARAMETER33("eventCreditGrantLandingPage", "sum(t1.event_credit_grant_landing_page)"),
+    PARAMETER34("eventCreditGrantLandingPageCost", "sum(t1.charge)/sum(t1.event_credit_grant_landing_page)"),
+    PARAMETER35("submit", "sum(t1.submit)"),
+    PARAMETER36("submitCost", "sum(t1.charge)/sum(t1.submit)"),
+    PARAMETER37("totalBalance", "balance"),
+    PARAMETER38("budget", "day_budget");
+
+    private String value;
+    private String formula;
+
+    CheckParametersCostEnum(String value, String formula) {
+        this.value = value;
+        this.formula = formula;
+    }
+
+    public static String getFormula(String value) {
+        for (CheckParametersCostEnum campaignType : CheckParametersCostEnum.values()) {
+            if (campaignType.getValue().equals(value)) {
+                return campaignType.getFormula();
+            }
+        }
+        return "";
+    }
+
+    public static boolean isInclude(String key) {
+        boolean include = false;
+        for (CheckParametersCostEnum e : CheckParametersCostEnum.values()) {
+            if (e.getValue().equals(key)) {
+                include = true;
+                break;
+            }
+        }
+        return include;
+    }
+
+    public String getValue() {
+        return value;
+    }
+
+    public void setValue(String value) {
+        this.value = value;
+    }
+
+    public String getFormula() {
+        return formula;
+    }
+
+    public void setFormula(String formula) {
+        this.formula = formula;
+    }
+}

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


Некоторые файлы не были показаны из-за большого количества измененных файлов