Browse Source

Merge remote-tracking branch 'origin/master'

syh 4 years ago
parent
commit
d613c622ca
100 changed files with 6042 additions and 754 deletions
  1. 36 0
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/DateUtils.java
  2. 18 10
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/AiKuaishouAdvertiserStrategyController.java
  3. 6 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/KuaishouAccountSpeedExploreLogController.java
  4. 12 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/KuaishouVideoEtlInfoController.java
  5. 39 204
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/TestController.java
  6. 0 62
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouDailyAccountReportLoadJob.java
  7. 0 60
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouDailyAccountReportNextDayStayJob.java
  8. 4 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouDailyGroupReportLoadJob.java
  9. 2 7
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/ProjectMemberServiceImpl.java
  10. 2 7
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/TransferAccountServiceImpl.java
  11. 49 17
      jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java
  12. 3 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/ProjectMapper.java
  13. 11 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/ProjectMapper.xml
  14. 4 0
      module-common/src/main/java/cn/com/ctop/common/module/service/IProjectService.java
  15. 1 2
      module-common/src/main/java/cn/com/ctop/common/module/service/ISysUserService.java
  16. 18 0
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/ProjectServiceImpl.java
  17. 15 2
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/SysUserServiceImpl.java
  18. 3 0
      module-common/src/main/java/cn/com/ctop/common/module/utils/StatusCode.java
  19. 30 0
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouAccountAudienceReportEtlJob.java
  20. 29 0
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouDailyAccountReportLoadEtlJob.java
  21. 19 5
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouDailyAccountReportLoadJob.java
  22. 3 3
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouDailyAudienceReportJob.java
  23. 5 4
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouDailyGroupReportLoadJob.java
  24. 85 0
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouDingPanCleanJob.java
  25. 5 1
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouGroupDailyReportJob.java
  26. 31 0
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouGroupExploreJob.java
  27. 30 0
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouHourlyAccountReportLoadEtlJob.java
  28. 1 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/controller/KuaiShouMaterialControer.java
  29. 37 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/entity/KuaishouGroupSpeedExploreLog.java
  30. 9 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/KuaishouAccountSpeedExploreLogMapper.java
  31. 14 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/KuaishouGroupSpeedExploreLogMapper.java
  32. 44 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/xml/KuaishouAccountSpeedExploreLogMapper.xml
  33. 5 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/xml/KuaishouGroupSpeedExploreLogMapper.xml
  34. 3 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/IAiKuaishouAdvertiserStrategyService.java
  35. 14 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/IKuaishouGroupSpeedExploreLogService.java
  36. 49 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/AiKuaishouAdvertiserStrategyServiceImpl.java
  37. 1 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/KuaiShouBatchUpdateServiceImpl.java
  38. 20 2
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/KuaishouAccountSpeedExploreLogServiceImpl.java
  39. 18 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/KuaishouGroupSpeedExploreLogServiceImpl.java
  40. 18 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/vo/SpeedExploreGroupVO.java
  41. 6 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/BatchController.java
  42. 240 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/DingPanController.java
  43. 0 36
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaiShouController.java
  44. 4 3
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/KuaiShouCampaignMapper.java
  45. 6 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/KuaiShouCreativeMapper.java
  46. 5 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/KuaiShouGroupMapper.java
  47. 8 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/KuaiShouVideoGetMapper.java
  48. 7 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouCampaignMapper.xml
  49. 22 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouCreativeMapper.xml
  50. 29 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouGroupMapper.xml
  51. 54 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouVideoGetMapper.xml
  52. 3 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaiShouCampaignService.java
  53. 6 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaiShouCreativeService.java
  54. 6 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaiShouGroupService.java
  55. 7 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaiShouVideoGetService.java
  56. 1 10
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaishouInterfaceService.java
  57. 2 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaishouVideoRelateCreativesService.java
  58. 6 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouCampaignServiceImpl.java
  59. 25 8
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouCreativeServiceImpl.java
  60. 25 11
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouGroupServiceImpl.java
  61. 20 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouVideoGetServiceImpl.java
  62. 41 105
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl.java
  63. 30 2
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouVideoRelateCreativesServiceImpl.java
  64. 259 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/EtlKuaiShouAccountMaterialOverviewController.java
  65. 266 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/EtlKuaiShouGroupDailyReportController.java
  66. 270 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/EtlKuaiShouNewlyController.java
  67. 334 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/EtlKuaishouAudienceAccountDailyController.java
  68. 266 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/EtlKuaishouReportAccountDailyController.java
  69. 354 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/EtlKuaishouReportAccountHourlyController.java
  70. 91 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/EtlKuaiShouAccountMaterialOverview.java
  71. 181 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/EtlKuaiShouGroupDailyReport.java
  72. 108 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/EtlKuaiShouNewly.java
  73. 139 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/EtlKuaishouAudienceAccountDaily.java
  74. 253 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/EtlKuaishouReportAccountDaily.java
  75. 322 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/EtlKuaishouReportAccountHourly.java
  76. 3 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/KuaishouReportDailyAccount.java
  77. 24 18
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/KuaishouReportHourlyAccount.java
  78. 80 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/enums/CheckParametersEnum.java
  79. 19 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/EtlKuaiShouAccountMaterialOverviewMapper.java
  80. 26 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/EtlKuaiShouGroupDailyReportMapper.java
  81. 22 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/EtlKuaiShouNewlyMapper.java
  82. 32 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/EtlKuaishouAudienceAccountDailyMapper.java
  83. 29 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/EtlKuaishouReportAccountDailyMapper.java
  84. 28 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/EtlKuaishouReportAccountHourlyMapper.java
  85. 3 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaishouAudienceReportDailyAccountMapper.java
  86. 25 19
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaishouReportDailyAccountMapper.java
  87. 4 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaishouReportDailyGroupMapper.java
  88. 6 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaishouReportHourlyAccountMapper.java
  89. 10 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaishouVideoEtlInfoMapper.java
  90. 74 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/EtlKuaiShouAccountMaterialOverviewMapper.xml
  91. 116 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/EtlKuaiShouGroupDailyReportMapper.xml
  92. 43 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/EtlKuaiShouNewlyMapper.xml
  93. 174 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/EtlKuaishouAudienceAccountDailyMapper.xml
  94. 277 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/EtlKuaishouReportAccountDailyMapper.xml
  95. 229 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/EtlKuaishouReportAccountHourlyMapper.xml
  96. 23 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouAudienceReportDailyAccountMapper.xml
  97. 294 2
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouReportDailyAccountMapper.xml
  98. 254 137
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouReportDailyGroupMapper.xml
  99. 158 6
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouReportHourlyAccountMapper.xml
  100. 0 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouVideoEtlInfoMapper.xml

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

@@ -138,6 +138,9 @@ public class DateUtils extends PropertyEditorSupport {
         return format;
     }
 
+
+
+
     // 指定模式的时间格式
     private static SimpleDateFormat getSDFormat(String pattern) {
         return new SimpleDateFormat(pattern);
@@ -1563,6 +1566,39 @@ public class DateUtils extends PropertyEditorSupport {
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         return sdf.format(calendar.getTime());
     }
+
+    /**
+     * 获取两个日期之间的所有日期集合
+     * @author ZHAOXA
+     * @param
+     * @return java.util.List<java.lang.String>
+     * @throws
+     */
+    public static List<String> getDays(String startTime, String endTime) {
+        // 返回的日期集合
+        List<String> days = new ArrayList<String>();
+        DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
+        try {
+            Date start = dateFormat.parse(startTime);
+            Date end = dateFormat.parse(endTime);
+
+            Calendar tempStart = Calendar.getInstance();
+            tempStart.setTime(start);
+
+            Calendar tempEnd = Calendar.getInstance();
+            tempEnd.setTime(end);
+            tempEnd.add(Calendar.DATE, +1);// 日期加1(包含结束)
+            while (tempStart.before(tempEnd)) {
+                days.add(dateFormat.format(tempStart.getTime()));
+                tempStart.add(Calendar.DAY_OF_YEAR, 1);
+            }
+
+        } catch (ParseException e) {
+            e.printStackTrace();
+        }
+
+        return days;
+    }
 }
 
 

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

@@ -8,11 +8,11 @@ import cn.com.ctop.common.module.utils.ResultMapUtils;
 import cn.com.ctop.common.module.utils.StatusCode;
 import cn.com.ctop.kuaishou.modules.ai.entity.AiKuaishouAdvertiserStrategy;
 import cn.com.ctop.kuaishou.modules.ai.service.IAiKuaishouAdvertiserStrategyService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouVideoRelateCreativesService;
 import com.alibaba.fastjson.JSONArray;
 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.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.shiro.SecurityUtils;
 import org.jeecg.common.api.vo.Result;
@@ -36,9 +36,14 @@ import java.util.*;
 @RequestMapping("/ctop/aiKuaishouAdvertiserStrategy")
 public class AiKuaishouAdvertiserStrategyController {
     @Autowired
+    private IKuaishouVideoRelateCreativesService kuaishouVideoRelateCreativesService;
+    @Autowired
     private IAiKuaishouAdvertiserStrategyService aiKuaishouAdvertiserStrategyService;
     @Autowired
+    private IUserAllocationService allocationService;
+    @Autowired
     private ISysRoleService sysRoleService;
+
     /**
      * 分页列表查询
      *
@@ -48,7 +53,6 @@ public class AiKuaishouAdvertiserStrategyController {
      * @param req
      * @return
      */
-    @ApiOperation(value = "快手账户策略设置信息表-分页列表查询", notes = "快手账户策略设置信息表-分页列表查询")
     @GetMapping(value = "/list")
     public Result<IPage<AiKuaishouAdvertiserStrategy>> queryPageList(AiKuaishouAdvertiserStrategy aiKuaishouAdvertiserStrategy,
                                                                      @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@@ -82,16 +86,12 @@ public class AiKuaishouAdvertiserStrategyController {
         return result;
     }
 
-    @Autowired
-    private IUserAllocationService allocationService;
-
     /**
      * 添加
      *
      * @param aiKuaishouAdvertiserStrategy
      * @return
      */
-    @ApiOperation(value = "快手账户策略设置信息表-添加", notes = "快手账户策略设置信息表-添加")
     @PostMapping(value = "/add")
     public Result<AiKuaishouAdvertiserStrategy> add(@RequestBody AiKuaishouAdvertiserStrategy aiKuaishouAdvertiserStrategy) {
         Result<AiKuaishouAdvertiserStrategy> result = new Result<>();
@@ -112,6 +112,13 @@ public class AiKuaishouAdvertiserStrategyController {
                 aiKuaishouAdvertiserStrategy.setAppId(appId);
             }
             aiKuaishouAdvertiserStrategyService.save(aiKuaishouAdvertiserStrategy);
+            Thread thread = new Thread(){
+                @Override
+                public void run() {
+                    kuaishouVideoRelateCreativesService.videoRelateCreatives(aiKuaishouAdvertiserStrategy.getAccountId());
+                }
+            };
+            thread.start();
             result.success("添加成功!");
         } catch (Exception e) {
             log.error(e.getMessage(), e);
@@ -119,7 +126,6 @@ public class AiKuaishouAdvertiserStrategyController {
         }
         return result;
     }
-
     /**
      * 编辑
      *
@@ -205,7 +211,6 @@ public class AiKuaishouAdvertiserStrategyController {
      * @param id
      * @return
      */
-    @ApiOperation(value = "快手账户策略设置信息表-通过id删除", notes = "快手账户策略设置信息表-通过id删除")
     @DeleteMapping(value = "/delete")
     public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
         try {
@@ -223,7 +228,6 @@ public class AiKuaishouAdvertiserStrategyController {
      * @param ids
      * @return
      */
-    @ApiOperation(value = "快手账户策略设置信息表-批量删除", notes = "快手账户策略设置信息表-批量删除")
     @DeleteMapping(value = "/deleteBatch")
     public Result<AiKuaishouAdvertiserStrategy> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
         Result<AiKuaishouAdvertiserStrategy> result = new Result<>();
@@ -242,7 +246,6 @@ public class AiKuaishouAdvertiserStrategyController {
      * @param id
      * @return
      */
-    @ApiOperation(value = "快手账户策略设置信息表-通过id查询", notes = "快手账户策略设置信息表-通过id查询")
     @GetMapping(value = "/queryById")
     public Result<AiKuaishouAdvertiserStrategy> queryById(@RequestParam(name = "id", required = true) String id) {
         Result<AiKuaishouAdvertiserStrategy> result = new Result<>();
@@ -255,4 +258,9 @@ public class AiKuaishouAdvertiserStrategyController {
         }
         return result;
     }
+
+    @GetMapping(value = "testCreate")
+    public Map<String,Object> testCreate(Long accountId){
+        return aiKuaishouAdvertiserStrategyService.testCreate(accountId);
+    }
 }

+ 6 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/KuaishouAccountSpeedExploreLogController.java

@@ -67,7 +67,12 @@ public class KuaishouAccountSpeedExploreLogController {
 			LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
 			kuaishouAccountSpeedExploreLog.setUserId(user.getId());
 			//1:查询此账户当前是否存在正在加速探索的账户
-			return kuaishouAccountSpeedExploreLogService.openSpeedExplore(kuaishouAccountSpeedExploreLog);
+			if(null!=kuaishouAccountSpeedExploreLog.getConvertType()&&(kuaishouAccountSpeedExploreLog.getConvertType()==2||kuaishouAccountSpeedExploreLog.getConvertType()==180||kuaishouAccountSpeedExploreLog.getConvertType()==53||kuaishouAccountSpeedExploreLog.getConvertType()==190)){
+				return kuaishouAccountSpeedExploreLogService.openSpeedExplore(kuaishouAccountSpeedExploreLog);
+			}else {
+				ResultMapUtils.setResultMap(result, StatusCode.KUAISHOU_SPEED_EXPLORE_ACTION_TYPE_NOT_CONFIG);
+				return result;
+			}
 		} catch (Exception e) {
 			log.error(e.getMessage(),e);
 			ResultMapUtils.setResultMap(result, StatusCode.COMMON_SERVER_ERROR);

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

@@ -8,6 +8,7 @@ import cn.com.ctop.kuaishou.modules.report.service.IKuaishouVideoEtlInfoService;
 import com.alibaba.excel.EasyExcelFactory;
 import com.alibaba.excel.ExcelWriter;
 import com.alibaba.excel.metadata.Sheet;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -98,6 +99,17 @@ public class KuaishouVideoEtlInfoController {
 		return result;
 	}
 
+	 @PostMapping(value = "/queryPageList")
+	 public Result<Object> queryPageList(@RequestBody JSONObject request) {
+		 try {
+			 return kuaishouVideoEtlInfoService.queryPageList(request);
+		 } catch (Exception e) {
+			 log.error("查询异常,", e.getMessage());
+			 e.printStackTrace();
+		 }
+		 return Result.error("查询失败");
+	 }
+
 	/**
 	  *   添加
 	 * @param kuaishouVideoEtlInfo

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

@@ -14,8 +14,7 @@ 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.material.service.IEtlKuaishouVideoInfoService;
-import cn.com.ctop.kuaishou.modules.report.service.IKuaiShouDailyAgentService;
+import cn.com.ctop.kuaishou.modules.report.service.*;
 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;
@@ -116,8 +115,44 @@ public class TestController {
 
     @Autowired
     private IUserAllocationService allocationService;
+    @Autowired
+    private IEtlKuaiShouNewlyService kuaiShouNewlyService;
+    static ExecutorService materialExecutorService = Executors.newFixedThreadPool(8);
+
+    @Autowired
+    private ICtopOauthTokenService tokenService;
+    @Autowired
+    private IEtlKuaiShouGroupDailyReportService etlKuaiShouGroupDailyReportService;
+    @Autowired
+    private IEtlKuaiShouAccountMaterialOverviewService accountMaterialOverviewService;
+
+    @Autowired
+    private IEtlKuaiShouNewlyService newlyService;
+    @Autowired
+    private IKuaishouReportDailyGroupService reportDailyGroupService;
+
+
+    @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");*/
+
+        List<CtopOauthToken> ctopOauthTokens = tokenService.selectKuaiShouToken();
+        // kuaishouInterfaceService.getAdvertiserReportDaily(token, getDate, getDate, "adScene");
+        ctopOauthTokens.forEach(token -> executorService.submit(() -> {
+            kuaishouInterfaceService.getAdvertiserReportDaily(token, parse1, parse2, "adScene");
+        }));
 
 
+
+        }
+
     @GetMapping("/getVideoByProjectId")
     public String getVideoByProjectId(Long projectId) {
         QueryWrapper<UserAllocation> queryWrapper = new QueryWrapper<>();
@@ -417,26 +452,6 @@ public class TestController {
 
     }
 
-    @GetMapping(value = "/getGroupReport")
-    public void getGroupReport() throws ParseException {
-        List<CtopOauthToken> tokens = oauthTokenService.selectKuaiShouToken();
-        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
-        Date parse1 = simpleDateFormat.parse("2020-09-12");
-        Date parse2 = simpleDateFormat.parse("2020-09-17");
-        for (CtopOauthToken token : tokens) {
-
-            suzhaoService.submit(new Runnable() {
-                @Override
-                public void run() {
-                    //1: 获取广告主信息数据
-                    kuaishouInterfaceService.getAdvertiserGroupReportDaily(token, parse1, parse2);
-                }
-            });
-
-
-        }
-    }
-
 
     @GetMapping(value = "/syncDouyinMusicAsc")
     public String syncDouyinMusicAsc() {
@@ -666,43 +681,6 @@ public class TestController {
         return "success";
     }
 
-    @GetMapping(value = "/getAccountList")
-    public void getAccountList(String startDate, String endDate) throws JobExecutionException {
-        Thread thread = new Thread() {
-            @Override
-            public void run() {
-                SimpleDateFormat sim = new SimpleDateFormat("yyyy-MM-dd");
-                try {
-                    Date start = sim.parse(startDate);
-                    Date end = sim.parse(endDate);
-                    //1:查询当日数据
-                    List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
-                    if (null == tokens || tokens.size() <= 0) {
-                        log.info("定时获取快手数据异常:未获取到可用的token");
-                        return;
-                    }
-
-                    executorService = Executors.newFixedThreadPool(3);
-                    tokens.forEach(token -> {
-                        executorService.submit(new Runnable() {
-                            @Override
-                            public void run() {
-                                //1: 获取广告主信息数据
-                                kuaishouInterfaceService.getAdvertiserReportDaily(token, start, end);
-                            }
-                        });
-                    });
-                } catch (ParseException e) {
-                    e.printStackTrace();
-                }
-
-
-            }
-        };
-        thread.start();
-
-    }
-
 
     @GetMapping(value = "/createCutTask")
     public String createCutTask(String startDate, String endDate) throws IOException {
@@ -726,13 +704,6 @@ public class TestController {
     }
 
 
-   /* @GetMapping(value = "/getToken")
-    public String getToken(Long accountId, String token, String refreshToken, Integer agentType) {
-        oauthTokenService.getKuaiShouRefreshToken(accountId, token, refreshToken, agentType);
-        return "Success";
-    }*/
-
-
     @GetMapping(value = "/getAccountReport")
     public String getAccountReport(Long accountId, String startDate, String endDate) throws ParseException {
         QueryWrapper<CtopOauthToken> oauthTokenQueryWrapper = new QueryWrapper<>();
@@ -743,34 +714,11 @@ public class TestController {
         SimpleDateFormat sim = new SimpleDateFormat("yyyy-MM-dd");
         Date date1 = sim.parse(startDate);
         Date date2 = sim.parse(endDate);
-        kuaishouInterfaceService.getAdvertiserReportDaily(token, date1, date2);
+        //    kuaishouInterfaceService.getAdvertiserReportDaily(token, date1, date2);
         return "Success";
     }
 
 
-    @GetMapping(value = "/getAccountReportList")
-    public String getAccountReportList(String startDate, String endDate) {
-        Result<String> result = new Result<>();
-        try {
-            SimpleDateFormat sim = new SimpleDateFormat("yyyy-MM-dd");
-            Date date1 = sim.parse(startDate);
-            Date date2 = sim.parse(endDate);
-            QueryWrapper<CtopOauthToken> tokenQueryWrapper = new QueryWrapper<>();
-            tokenQueryWrapper.eq("media_id", 2);
-            List<CtopOauthToken> ctopOauthTokens = tokenMapper.selectList(tokenQueryWrapper);
-            if (!Check.isNull(ctopOauthTokens)) {
-                for (CtopOauthToken token : ctopOauthTokens) {
-                    kuaishouInterfaceService.getAdvertiserReportDaily(token, date1, date2);
-                }
-            }
-        } catch (Exception e) {
-            e.printStackTrace();
-            result.setSuccess(false);
-        }
-        return "success";
-    }
-
-
     @GetMapping(value = "/updateCode")
     public String updateCode() {
         List<MaterialInfo> list = materialInfoService.list();
@@ -907,38 +855,6 @@ public class TestController {
         return "success";
     }
 
-    @GetMapping(value = "/getGroupData")
-    public String getGroupData() {
-
-
-        Date endDate = new Date();
-        QueryWrapper<CtopOauthToken> tokenQueryWrapper = new QueryWrapper<>();
-        tokenQueryWrapper.eq("media_id", 2);
-        List<CtopOauthToken> ctopOauthTokens = tokenMapper.selectList(tokenQueryWrapper);
-        for (CtopOauthToken token : ctopOauthTokens) {
-
-            for (int i = 0; i < 7; i++) {
-                Date getStartDate = DateUtils.addDay(endDate, -i);
-                //3:获取广告组信息数据
-                kuaishouInterfaceService.getAdvertiserGroupReportHourly(token, getStartDate, getStartDate);
-            }
-            for (int i = 0; i < 6; i++) {
-                Date getStartDate = new Date();
-                Date getEndDate = new Date();
-                if (i == 0) {
-                    getStartDate = DateUtils.addDay(endDate, -175 + i * 30);
-                    getEndDate = DateUtils.addDay(endDate, -150 + i * 30);
-                } else {
-                    getStartDate = DateUtils.addDay(endDate, -180 + i * 30);
-                    getEndDate = DateUtils.addDay(endDate, -150 + i * 30);
-                }
-                //3:获取广告组信息数据
-                kuaishouInterfaceService.getAdvertiserGroupReportDaily(token, getStartDate, getEndDate);
-            }
-        }
-        return "Success";
-    }
-
 
     @GetMapping(value = "/gerCreative")
     public void gerCreative() {
@@ -1029,13 +945,6 @@ public class TestController {
         }
     }
 
-
-    @Autowired
-    private IBytedancePlanDailyReportService planDailyReportService;
-    @Autowired
-    private ICtopOauthTokenService tokenService;
-
-
     @Autowired
     private IByteDanceAdvertiserDataService advertiserDataService;
 
@@ -1064,38 +973,6 @@ public class TestController {
     private IBytedancePlanHourlyReportService planHourlyReportService;
 
 
-    @GetMapping(value = "/AccountReportByAccount")
-    public void AccountReportByAccount(Long accountId, String startDateStr, String endDateStr) {
-        QueryWrapper<CtopOauthToken> oauthTokenQueryWrapper = new QueryWrapper<>();
-        oauthTokenQueryWrapper.eq("media_id", 2);
-        oauthTokenQueryWrapper.eq("account_id", accountId);
-        oauthTokenQueryWrapper.last("limit 1");
-        CtopOauthToken token = tokenMapper.selectOne(oauthTokenQueryWrapper);
-        executorService.submit(new Runnable() {
-            @Override
-            public void run() {
-                try {
-                    SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
-                    Date startDate = null;
-                    Date endDate = null;
-                    try {
-                        startDate = simpleDateFormat.parse(startDateStr);
-                        endDate = simpleDateFormat.parse(endDateStr);
-                    } catch (ParseException e) {
-                        e.printStackTrace();
-                    }
-                    kuaishouInterfaceService.getAdvertiserReportDaily(token, startDate, endDate);
-
-                    Thread.sleep(1 * 200);
-                    //  kuaishouInterfaceService.getAppList(token.getAccountId(), token.getAccessToken());
-                } catch (Exception e) {
-                    e.printStackTrace();
-                }
-            }
-        });
-    }
-
-
     @GetMapping(value = "/getAllCreativeList")
     public void getAllCreativeList() {
 
@@ -1154,27 +1031,6 @@ public class TestController {
 
     }
 
-    @GetMapping(value = "/KuaishouDailyAccountReportLoadJob")
-    public void KuaishouDailyAccountReportLoadJob() {
-        Date getDate = DateUtils.addDay(new Date(), -2);
-        //1:查询当日数据
-        List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
-        if (null == tokens || tokens.size() <= 0) {
-            log.info("定时获取快手数据异常:未获取到可用的token");
-            return;
-        }
-
-        executorService = Executors.newFixedThreadPool(3);
-        tokens.forEach(token -> {
-            executorService.submit(new Runnable() {
-                @Override
-                public void run() {
-                    //1: 获取广告主信息数据
-                    kuaishouInterfaceService.getAdvertiserReportDaily(token, getDate, getDate);
-                }
-            });
-        });
-    }
 
     @Autowired
     private IBytedanceEffectVideoInfoService effectVideoInfoService;
@@ -1371,27 +1227,6 @@ public class TestController {
     IBytedanceVideoReportService bytedanceVideoReportService;
     @Autowired
     IETLReportBytedanceVideoService etlReportBytedanceVideoService;
-    @GetMapping("execute")
-    public Map<String,Object> execute(Long accountId) throws Exception {
-        Map<String,Object>result = new HashMap<>();
-        CtopOauthToken token = tokenService.getTokenByAccountId(accountId);
-        kuaishouInterfaceService.getGroupList(token,new Date(),new Date());
-        kuaishouInterfaceService.getAdvertiserGroupReportDaily(token,new Date(),new Date());
-        ResultMapUtils.setResultMap(result,StatusCode.COMMON_SUCCESS);
-        return result;
-    }
 
-    @Autowired
-    private IEtlKuaishouVideoInfoService videoEtlInfoService;
-
-    @GetMapping("loadJiaoyangData")
-    public Map<String,Object> testJiaoyangData(){
-        Map<String,Object>result = new HashMap<>();
-        Date startDate = DateUtils.addDay(new Date(), -10);
-        for(int i=0;i<=10;i++){
-            videoEtlInfoService.etlKuaishouVideoInfo(DateUtils.formatDate(DateUtils.addDay(startDate,i)));
-        }
-        ResultMapUtils.setResultMap(result,StatusCode.COMMON_SUCCESS);
-        return result;
-    }
+
 }

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

@@ -1,62 +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.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.util.Date;
-import java.util.List;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-
-/**
- * 快手广告主分天数据
- *
- * @author syh
- */
-@Slf4j
-public class KuaishouDailyAccountReportLoadJob implements Job {
-    @Autowired
-    private ICtopOauthTokenService tokenService;
-    @Autowired
-    private IKuaishouInterfaceService kuaishouInterfaceService;
-    static ExecutorService executorService = null;
-
-    @Override
-    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
-        Thread thread = new Thread() {
-            @Override
-            public void run() {
-                Date getDate2 = DateUtils.addDay(new Date(), -2);
-                Date getDate = DateUtils.addDay(new Date(), -1);
-                //1:查询当日数据
-                List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
-                if (null == tokens || tokens.size() <= 0) {
-                    log.info("定时获取快手数据异常:未获取到可用的token");
-                    return;
-                }
-
-                executorService = Executors.newFixedThreadPool(3);
-                tokens.forEach(token -> {
-                    executorService.submit(new Runnable() {
-                        @Override
-                        public void run() {
-                            //跑两天前的账户报表---次留统计用
-                            kuaishouInterfaceService.getAdvertiserReportDaily(token, getDate2, getDate2);
-                            //1: 获取广告主信息数据
-                            kuaishouInterfaceService.getAdvertiserReportDaily(token, getDate, getDate);
-                        }
-                    });
-                });
-            }
-        };
-        thread.start();
-
-    }
-}

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

@@ -1,60 +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.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.util.Date;
-import java.util.List;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-
-/**
- * 快手广告主次留数据--凌晨跑两天前的次留,统一跑起来
- *
- * @author sunzhen
- */
-@Slf4j
-public class KuaishouDailyAccountReportNextDayStayJob implements Job {
-    @Autowired
-    private ICtopOauthTokenService tokenService;
-    @Autowired
-    private IKuaishouInterfaceService kuaishouInterfaceService;
-    static ExecutorService executorService = null;
-
-    @Override
-    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
-        log.info("快手次留率定时任务开始");
-        Thread thread = new Thread() {
-            @Override
-            public void run() {
-                Date getDate = DateUtils.addDay(new Date(), -1);
-                //1:查询当日数据
-                List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
-                if (null == tokens || tokens.size() <= 0) {
-                    log.info("定时获取快手数据异常:未获取到可用的token");
-                    return;
-                }
-
-                executorService = Executors.newFixedThreadPool(3);
-                tokens.forEach(token -> {
-                    executorService.submit(new Runnable() {
-                        @Override
-                        public void run() {
-                            //1: 获取广告主信息数据
-                            kuaishouInterfaceService.getAdvertiserReportDaily(token, getDate, getDate);
-                        }
-                    });
-                });
-            }
-        };
-        thread.start();
-
-    }
-}

+ 4 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouDailyGroupReportLoadJob.java

@@ -3,6 +3,7 @@ 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.kuaishou.modules.batch.service.IKuaishouInterfaceService;
+import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyGroupService;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.util.DateUtils;
 import org.quartz.Job;
@@ -26,6 +27,8 @@ public class KuaishouDailyGroupReportLoadJob implements Job {
     private ICtopOauthTokenService tokenService;
     @Autowired
     private IKuaishouInterfaceService kuaishouInterfaceService;
+    @Autowired
+    private IKuaishouReportDailyGroupService reportDailyGroupService;
     static ExecutorService executorService = null;
 
     @Override
@@ -48,7 +51,7 @@ public class KuaishouDailyGroupReportLoadJob implements Job {
                         @Override
                         public void run() {
                             //获取广告组信息数据
-                            kuaishouInterfaceService.getAdvertiserGroupReportDaily(token, getDate, getDate);
+                            reportDailyGroupService.getAdvertiserGroupReportDaily(token, getDate, getDate);
                         }
                     });
                 });

+ 2 - 7
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/ProjectMemberServiceImpl.java

@@ -361,14 +361,9 @@ public class ProjectMemberServiceImpl extends ServiceImpl<ProjectMemberMapper, P
         }
         Map<String, String> userMap = new HashMap<>();
         if (!Check.isNullMap(userIdMap)) {
-            List<JSONObject> userList = userService.getUserMapByMap(userIdMap);
-            if (!Check.isNull(userList)) {
-                for (int i = 0; i < userList.size(); i++) {
-                    JSONObject userJson = userList.get(i);
-                    userMap.put(userJson.getString("id"), userJson.getString("realname"));
-                }
-            }
+            userMap = userService.getUserMapByMap(userIdMap);
         }
+
         Map<String, String> advertiserMap = new HashMap<>();
         if (!Check.isNullMap(advertiserIdMap)) {
             List<JSONObject> advertiserList = advertiserService.getAdvertiserByMap(advertiserIdMap);

+ 2 - 7
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/TransferAccountServiceImpl.java

@@ -84,14 +84,9 @@ public class TransferAccountServiceImpl extends ServiceImpl<TransferAccountMappe
         }
         Map<String, String> userMap = new HashMap<>();
         if (!Check.isNullMap(userIdMap)) {
-            List<JSONObject> userList = userService.getUserMapByMap(userIdMap);
-            if (!Check.isNull(userList)) {
-                for (int i = 0; i < userList.size(); i++) {
-                    JSONObject userJson = userList.get(i);
-                    userMap.put(userJson.getString("id"), userJson.getString("realname"));
-                }
-            }
+            userMap = userService.getUserMapByMap(userIdMap);
         }
+
         Map<String, String> advertiserMap = new HashMap<>();
         if (!Check.isNullMap(advertiserIdMap)) {
             List<JSONObject> advertiserList = advertiserService.getAdvertiserByMap(advertiserIdMap);

+ 49 - 17
jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java

@@ -20,6 +20,7 @@ import cn.com.ctop.toutiao.modules.material.service.IByteDanceAdvertiserDataServ
 import cn.com.ctop.toutiao.modules.report.entity.BytedanceAccountReportTaskRecord;
 import cn.com.ctop.toutiao.modules.report.mapper.BytedanceReportMaterialDailyMapper;
 import cn.com.ctop.toutiao.modules.report.service.*;
+import com.alibaba.fastjson.JSONObject;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.util.DateUtils;
 import org.junit.Test;
@@ -62,14 +63,37 @@ public class SampleTest {
     private IBindAccountLoginService bindAccountLoginService;
     @Autowired
     private IKuaishouWebInterfaceService kuaishouWebInterfaceService;
- /*   @Autowired
-    private IByteDanceAdvertiserDataService advertiserDataService;
+    /*   @Autowired
+       private IByteDanceAdvertiserDataService advertiserDataService;
 
-*/
+   */
+    @Autowired
+    private IKuaishouReportDailyGroupService reportDailyGroupService;
+    @Autowired
+    private IEtlKuaiShouAccountMaterialOverviewService kuaiShouAccountMaterialOverviewService;
 
 
     @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");
+        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);
@@ -81,12 +105,12 @@ public class SampleTest {
         Date parse = simpleDateFormat.parse("2021-02-02");
         kuaishouInterfaceService.getAdvertiserReportDaily(token, parse, parse);*/
 
-        CtopOauthToken token = new CtopOauthToken();
+     /*   CtopOauthToken token = new CtopOauthToken();
         token.setAccountId(9767055L);
         token.setAccessToken("28e4e6b124e1443d6971ba4c699de6c9");
 
         kuaishouInterfaceService.getVideoList(token, null, null);
-        kuaishouInterfaceService.getVideoInfo("28e4e6b124e1443d6971ba4c699de6c9",9767055L,"5208131540349742192");
+        kuaishouInterfaceService.getVideoInfo("28e4e6b124e1443d6971ba4c699de6c9", 9767055L, "5208131540349742192");*/
 
      /*   CtopOauthToken tokenByAccountId = tokenService.getTokenByAccountId(1662234704806924L);
         advertiserDataService.getMaterialList(tokenByAccountId);*/
@@ -477,9 +501,10 @@ public class SampleTest {
     IRuleByteDanceAccountService ruleByteDanceAccountService;
     @Autowired
     IAiKuaishouNewCreateCampaign aiKuaishouNewCreateCampaign;
+
     @Test
-    public void testLoadBytedanceDataV2(){
-        String accountIds=
+    public void testLoadBytedanceDataV2() {
+        String accountIds =
                 "1675440464386062," +
                         "1688606248211533," +
                         "1669181787105294," +
@@ -532,11 +557,11 @@ public class SampleTest {
                         "1674634579279885," +
                         "1650263841162253," +
                         "1672178052130888";
-        String [] accountArray = accountIds.split(",");
-        for (int i=0;i<accountArray.length;i++){
+        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);
+            reportService.getAdvertiserReport(token, DateUtils.parseDate("2021-01-14", "yyyy-MM-dd"), DateUtils.parseDate("2021-01-14", "yyyy-MM-dd"), CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
         }
     }
 
@@ -556,7 +581,7 @@ public class SampleTest {
         countDownLatch = new CountDownLatch(tokens.size());
         tokens.forEach(token -> executorService.submit(() -> {
             try {
-                kuaishouReportDailyImageService.getMaterialImageReport(token.getAccountId(),token.getAccessToken(), "2021-01-17", "2021-01-31", 1);
+                kuaishouReportDailyImageService.getMaterialImageReport(token.getAccountId(), token.getAccessToken(), "2021-01-17", "2021-01-31", 1);
             } catch (Exception e) {
 
             } finally {
@@ -572,18 +597,25 @@ public class SampleTest {
 
     @Autowired
     private IEtlKuaishouAccountMaterialReportDailyService dailyService;
+
     @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 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)));
         }
     }
+
     @Autowired
     private IEtlKuaishouVideoInfoService videoEtlInfoService;
+
     @Test
     public void etlKuaishouVideoInfo(){
-        CtopOauthToken token = tokenService.getTokenByAccountId(9792538L);
-        kuaishouInterfaceService.getGroupList(token,new Date(),new Date());
+        Date startDate = DateUtils.parseDate("2020-09-11","yyyy-MM-dd");
+        for(int i=0;i<365;i++){
+//            dailyService.etlKuaishouAccountMaterialReportDailyData(DateUtils.formatDate(DateUtils.addDay(startDate,i)));
+            videoEtlInfoService.etlKuaishouVideoInfo(DateUtils.formatDate(DateUtils.addDay(startDate,i)));
+        }
     }
+
 }

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

@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * 项目
@@ -24,4 +25,6 @@ public interface ProjectMapper extends BaseMapper<Project> {
     String querySupplierCodeById(@Param("projectId") Long projectId);
 
     List<JSONObject> getProjectListByIds(@Param("ids") JSONArray projectIdArray);
+
+    List<JSONObject> getListByMap(@Param("ids") Map<Long, Long> projectIdMap);
 }

+ 11 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/ProjectMapper.xml

@@ -43,5 +43,16 @@
 
 
     </select>
+    <select id="getListByMap" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        id as 'id',
+        project_name as 'projectName'
+        from ctop_project
+        where id in
+        <foreach collection="ids" item="ids" separator="," open="(" close=")">
+            #{ids}
+        </foreach>
+
+    </select>
 
 </mapper>

+ 4 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/IProjectService.java

@@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.service.IService;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * 项目
@@ -23,4 +24,7 @@ public interface IProjectService extends IService<Project> {
     String getSupplierCodeById(Long projectId);
 
     List<JSONObject> getProjectListByIds(JSONArray projectIdArray);
+
+
+    Map<Long, String> getProjectMap(Map<Long, Long> projectIdMap);
 }

+ 1 - 2
module-common/src/main/java/cn/com/ctop/common/module/service/ISysUserService.java

@@ -3,7 +3,6 @@ package cn.com.ctop.common.module.service;
 import cn.com.ctop.common.module.entity.SysUser;
 import cn.com.ctop.common.module.model.SysUserSysDepartModel;
 import cn.com.ctop.common.module.vo.SysUserVo;
-import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -269,5 +268,5 @@ public interface ISysUserService extends IService<SysUser> {
 
     List<SysUser> queryPageList(SysUser user);
 
-    List<JSONObject> getUserMapByMap(Map<String, String> userIdMap);
+    Map<String, String> getUserMapByMap(Map<String, String> userIdMap);
 }

+ 18 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/impl/ProjectServiceImpl.java

@@ -3,6 +3,7 @@ package cn.com.ctop.common.module.service.impl;
 import cn.com.ctop.common.module.entity.Project;
 import cn.com.ctop.common.module.mapper.ProjectMapper;
 import cn.com.ctop.common.module.service.IProjectService;
+import cn.com.ctop.common.module.utils.Check;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -10,7 +11,9 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 /**
  * 项目
@@ -47,4 +50,19 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
     public List<JSONObject> getProjectListByIds(JSONArray projectIdArray) {
         return projectMapper.getProjectListByIds(projectIdArray);
     }
+
+    @Override
+    public Map<Long, String> getProjectMap(Map<Long, Long> projectIdMap) {
+        Map<Long, String> projectMap = new HashMap<>();
+        if (!Check.isNullMap(projectIdMap)) {
+            List<JSONObject> projectList = projectMapper.getListByMap(projectIdMap);
+            if (!Check.isNull(projectList)) {
+                for (int i = 0; i < projectList.size(); i++) {
+                    JSONObject projectJson = projectList.get(i);
+                    projectMap.put(projectJson.getLong("id"), projectJson.getString("projectName"));
+                }
+            }
+        }
+        return projectMap;
+    }
 }

+ 15 - 2
module-common/src/main/java/cn/com/ctop/common/module/service/impl/SysUserServiceImpl.java

@@ -5,6 +5,7 @@ import cn.com.ctop.common.module.mapper.*;
 import cn.com.ctop.common.module.model.SysUserSysDepartModel;
 import cn.com.ctop.common.module.service.ISysBaseApi;
 import cn.com.ctop.common.module.service.ISysUserService;
+import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.vo.SysUserDepVo;
 import cn.com.ctop.common.module.vo.SysUserVo;
 import com.alibaba.fastjson.JSONObject;
@@ -289,8 +290,20 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
     }
 
     @Override
-    public List<JSONObject> getUserMapByMap(Map<String, String> userIdMap) {
-        return userMapper.getUserMapByMap(userIdMap);
+    public Map<String, String> getUserMapByMap(Map<String, String> userIdMap) {
+
+        Map<String, String> userMap = new HashMap<>();
+        if (!Check.isNullMap(userIdMap)) {
+            List<JSONObject> userList = userMapper.getUserMapByMap(userIdMap);
+            if (!Check.isNull(userList)) {
+                for (int i = 0; i < userList.size(); i++) {
+                    JSONObject userJson = userList.get(i);
+                    userMap.put(userJson.getString("id"), userJson.getString("realname"));
+                }
+            }
+        }
+
+        return userMap;
     }
 
     @Override

+ 3 - 0
module-common/src/main/java/cn/com/ctop/common/module/utils/StatusCode.java

@@ -59,6 +59,9 @@ public enum StatusCode {
 
     KUAISHOU_API_ACCOUNT_SPEED_EXPLORING("此账户加速探索尚未完成",-5001,false),
 
+    KUAISHOU_SPEED_EXPLORE_ACTION_TYPE_NOT_CONFIG("加速探索尚不支持此类优化目标",-6001,false),
+    KUAISHOU_SPEED_EXPLORE_FAIL("加速探索失败",-6002,false),
+
     KUAISHOU_CRAWLER_APP_SUCCESS("爬虫运行正常", 0, true),
     KUAISHOU_CRAWLER_APP_TASK_END("爬虫任务运行结束", 1, true),
     KUAISHOU_CRAWLER_APP_JOB_StART("任务开始执行开始", 0, true),

+ 30 - 0
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouAccountAudienceReportEtlJob.java

@@ -0,0 +1,30 @@
+package cn.com.ctop.job.kuaishou.handler;
+
+import cn.com.ctop.kuaishou.modules.report.service.IEtlKuaishouAudienceAccountDailyService;
+import cn.com.ctop.kuaishou.modules.report.service.IEtlKuaishouReportAccountDailyService;
+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.stereotype.Component;
+
+/**
+ * 清洗盯盘人群——年龄、性别数据
+ *
+ * @author syh
+ */
+@Component
+public class KuaishouAccountAudienceReportEtlJob {
+
+    @Autowired
+    private IEtlKuaishouAudienceAccountDailyService etlKuaishouAudienceAccountDailyService;
+
+    @XxlJob("kuaishouAccountAudienceReportEtlJob")
+    public void execute() throws Exception {
+        try {
+            etlKuaishouAudienceAccountDailyService.queryEveryDayAudienceInfo();
+            XxlJobHelper.log("queryEveryDayAudienceInfo success");
+        } catch (Exception e) {
+            XxlJobHelper.log(e.getMessage());
+        }
+    }
+}

+ 29 - 0
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouDailyAccountReportLoadEtlJob.java

@@ -0,0 +1,29 @@
+package cn.com.ctop.job.kuaishou.handler;
+
+import cn.com.ctop.kuaishou.modules.report.service.IEtlKuaishouReportAccountDailyService;
+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.stereotype.Component;
+
+/**
+ * 账户维度-盯盘每日数据
+ *
+ * @author syh
+ */
+@Component
+public class KuaishouDailyAccountReportLoadEtlJob {
+
+    @Autowired
+    private IEtlKuaishouReportAccountDailyService iEtlKuaishouReportAccountDailyService;
+
+    @XxlJob("kuaishouDailyAccountReportLoadEtl")
+    public void execute() throws Exception {
+        try {
+            iEtlKuaishouReportAccountDailyService.queryEveryDayDataForAccount();
+            XxlJobHelper.log("queryEveryDayDataForAccount success");
+        } catch (Exception e) {
+            XxlJobHelper.log(e.getMessage());
+        }
+    }
+}

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

@@ -31,19 +31,33 @@ public class KuaishouDailyAccountReportLoadJob {
     public void execute() throws Exception {
         Date getDate = DateUtils.addDay(new Date(), -1);
         Date getDate2 = DateUtils.addDay(new Date(), -2);
-
         //1:查询当日数据
         List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
         if (null == tokens || tokens.isEmpty()) {
             XxlJobHelper.log("定时获取快手数据异常:未获取到可用的token");
             XxlJobHelper.handleFail();
-            return ;
+            return;
         }
-        tokens.forEach(token -> executorService.submit(() ->{
-                    kuaishouInterfaceService.getAdvertiserReportDaily(token, getDate2, getDate2);
-                    kuaishouInterfaceService.getAdvertiserReportDaily(token, getDate, getDate);
+        tokens.forEach(token -> executorService.submit(() -> {
+            kuaishouInterfaceService.getAdvertiserReportDaily(token, getDate2, getDate, null);
+        }));
+    }
 
 
+    @XxlJob("kuaishouDailyAccountAdSceneReport")
+    public void kuaishouDailyAccountAdSceneReport() throws Exception {
+        Date getDate = DateUtils.addDay(new Date(), -1);
+        Date getDate2 = DateUtils.addDay(new Date(), -2);
+        //1:查询当日数据
+        List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
+        if (null == tokens || tokens.isEmpty()) {
+            XxlJobHelper.log("定时获取快手数据异常:未获取到可用的token");
+            XxlJobHelper.handleFail();
+            return;
+        }
+        tokens.forEach(token -> executorService.submit(() -> {
+            kuaishouInterfaceService.getAdvertiserReportDaily(token, getDate2, getDate, "adScene");
         }));
     }
+
 }

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

@@ -41,13 +41,13 @@ public class KuaishouDailyAudienceReportJob {
             @Override
             public void run() {
                 List<String> dates = new ArrayList<>();
-                for (int i = 2; i < 33; i++) {
+                for (int i = 5; i < 36; i++) {
                     String dat = DateUtils.getLastDay(DateUtils.date2Str(), i);
                     dates.add(dat);
                 }
                 XxlJobHelper.log("-----------清洗日期:" + dates.toString());
                 //  9556344、9743727、9743738、9812668、9901966、9767034
-                CtopOauthToken token = tokenService.getTokenByAccountId(9556344L);
+                CtopOauthToken token = tokenService.getTokenByAccountId(9812668L);
                 int page = 1;
                 int pageSize = 2000;
                 List<KuaiShouGroup> kuaiShouGroups = kuaiShouGroupService.queryUnitInfoByAccountId(token.getAccountId());
@@ -69,7 +69,7 @@ public class KuaishouDailyAudienceReportJob {
         try {
             for (KuaiShouGroup kuaiShouGroup : kuaiShouGroups) {
                 kuaishouAudienceReportDailyService.crowdAnalysisReport(token, date, type, kuaiShouGroup.getCampaignId(), kuaiShouGroup.getUnitId(), page, pageSize);
-                Thread.sleep(500);
+                Thread.sleep(600);
             }
         } catch (Exception e) {
             XxlJobHelper.log("定时获取人群分析报表数据异常", e);

+ 5 - 4
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouDailyGroupReportLoadJob.java

@@ -2,7 +2,7 @@ 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.kuaishou.modules.batch.service.IKuaishouInterfaceService;
+import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyGroupService;
 import com.xxl.job.core.context.XxlJobHelper;
 import com.xxl.job.core.handler.annotation.XxlJob;
 import org.jeecg.common.util.DateUtils;
@@ -24,8 +24,9 @@ public class KuaishouDailyGroupReportLoadJob {
     @Autowired
     private ICtopOauthTokenService tokenService;
     @Autowired
-    private IKuaishouInterfaceService kuaishouInterfaceService;
+    private IKuaishouReportDailyGroupService reportDailyGroupService;
     static ExecutorService executorService = Executors.newFixedThreadPool(3);
+
     @XxlJob("kuaishouDailyGroupReport")
     public void execute() throws Exception {
         Date getDate = DateUtils.addDay(new Date(), -1);
@@ -34,8 +35,8 @@ public class KuaishouDailyGroupReportLoadJob {
         if (null == tokens || tokens.size() <= 0) {
             XxlJobHelper.log("定时获取快手数据异常:未获取到可用的token");
             XxlJobHelper.handleFail();
-            return ;
+            return;
         }
-        tokens.forEach(token -> executorService.submit(() -> kuaishouInterfaceService.getAdvertiserGroupReportDaily(token, getDate, getDate)));
+        tokens.forEach(token -> executorService.submit(() -> reportDailyGroupService.getAdvertiserGroupReportDaily(token, getDate, getDate)));
     }
 }

+ 85 - 0
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouDingPanCleanJob.java

@@ -0,0 +1,85 @@
+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.kuaishou.modules.report.service.IEtlKuaiShouAccountMaterialOverviewService;
+import cn.com.ctop.kuaishou.modules.report.service.IEtlKuaiShouGroupDailyReportService;
+import cn.com.ctop.kuaishou.modules.report.service.IEtlKuaiShouNewlyService;
+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.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+@Component
+public class KuaishouDingPanCleanJob {
+    @Autowired
+    private ICtopOauthTokenService tokenService;
+    @Autowired
+    private IEtlKuaiShouGroupDailyReportService etlKuaiShouGroupDailyReportService;
+    @Autowired
+    private IEtlKuaiShouAccountMaterialOverviewService accountMaterialOverviewService;
+
+    @Autowired
+    private IEtlKuaiShouNewlyService newlyService;
+
+
+    static ExecutorService executorService = Executors.newFixedThreadPool(8);
+    static ExecutorService materialExecutorService = Executors.newFixedThreadPool(8);
+
+    @XxlJob("cleanNewlyData")
+    public void cleanNewlyData() {
+        String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
+        String yesterdayDate = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -1);
+        newlyService.cleanNewlyData(yesterdayDate);
+        XxlJobHelper.log("快手清洗上新计划数据完成");
+    }
+
+
+    @XxlJob("cleanGroupReport")
+    public void cleanGroupReport() throws Exception {
+        List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
+        if (null == tokens || tokens.isEmpty()) {
+            XxlJobHelper.log("定时获取快手数据异常:未获取到可用的token");
+            XxlJobHelper.handleFail();
+            return;
+        }
+        String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
+        for (CtopOauthToken token : tokens) {
+            executorService.submit(new Runnable() {
+                @Override
+                public void run() {
+                    etlKuaiShouGroupDailyReportService.getGroupReport(token.getAccountId(), token.getAccessToken(), nowDate, nowDate, 1);
+                }
+            });
+        }
+    }
+
+
+    @XxlJob("cleanAccountMaterialOverview")
+    public void cleanAccountMaterialOverview() throws Exception {
+        String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
+        String yesterdayDate = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -1);
+        List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
+        if (null == tokens || tokens.isEmpty()) {
+            XxlJobHelper.log("定时获取快手数据异常:未获取到可用的token");
+            XxlJobHelper.handleFail();
+            return;
+        }
+        for (CtopOauthToken token : tokens) {
+            materialExecutorService.submit(new Runnable() {
+                @Override
+                public void run() {
+                    accountMaterialOverviewService.cleanAccountMaterialOverview(token.getAccountId(), yesterdayDate);
+                }
+            });
+        }
+
+
+    }
+
+}

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

@@ -3,6 +3,7 @@ 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.kuaishou.modules.batch.service.IKuaishouInterfaceService;
+import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyGroupService;
 import com.xxl.job.core.context.XxlJobHelper;
 import com.xxl.job.core.handler.annotation.XxlJob;
 import org.jeecg.common.util.DateUtils;
@@ -22,8 +23,11 @@ public class KuaishouGroupDailyReportJob {
     private ICtopOauthTokenService tokenService;
     @Autowired
     private IKuaishouInterfaceService kuaishouInterfaceService;
+    @Autowired
+    private IKuaishouReportDailyGroupService reportDailyGroupService;
 
     static ExecutorService executorService = Executors.newFixedThreadPool(5);
+
     @XxlJob("kuaishouGroupDailyReportJob")
     public void execute() throws ParseException {
         String date = DateUtils.getDate("yyyy-MM-dd");
@@ -34,7 +38,7 @@ public class KuaishouGroupDailyReportJob {
         Date parse2 = simpleDateFormat.parse(endDate);
         List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
         tokens.forEach(token -> executorService.submit(() ->
-                kuaishouInterfaceService.getAdvertiserGroupReportDaily(token, parse, parse2))
+                reportDailyGroupService.getAdvertiserGroupReportDaily(token, parse, parse2))
         );
         XxlJobHelper.log("快手物料数据同步完成");
     }

+ 31 - 0
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouGroupExploreJob.java

@@ -0,0 +1,31 @@
+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.kuaishou.modules.report.service.IKuaishouGroupExploreService;
+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.stereotype.Component;
+
+import java.text.ParseException;
+import java.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+@Component
+public class KuaishouGroupExploreJob {
+    @Autowired
+    private ICtopOauthTokenService tokenService;
+    @Autowired
+    private IKuaishouGroupExploreService kuaishouGroupExploreService;
+    static ExecutorService executorService = Executors.newFixedThreadPool(5);
+    @XxlJob("kuaishouGroupExploreReportJob")
+    public void execute() throws ParseException {
+        List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
+        tokens.forEach(token -> executorService.submit(() ->
+                kuaishouGroupExploreService.getReportByAccount(token))
+        );
+        XxlJobHelper.log("快手物料数据同步完成");
+    }
+}

+ 30 - 0
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouHourlyAccountReportLoadEtlJob.java

@@ -0,0 +1,30 @@
+package cn.com.ctop.job.kuaishou.handler;
+
+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.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+/**
+ * 账户维度-盯盘每小时数据
+ *
+ * @author syh
+ */
+@Component
+public class KuaishouHourlyAccountReportLoadEtlJob {
+
+    @Autowired
+    private IEtlKuaishouReportAccountHourlyService hourlyService;
+
+    @XxlJob("kuaishouHourlyAccountReportLoadEtl")
+    public void execute() throws Exception {
+        try {
+            hourlyService.queryEveryhourlyDataForAccount();
+            XxlJobHelper.log("queryEveryhourlyDataForAccount success");
+        } catch (Exception e) {
+            XxlJobHelper.log(e.getMessage());
+        }
+    }
+}

+ 1 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/controller/KuaiShouMaterialControer.java

@@ -100,7 +100,7 @@ public class KuaiShouMaterialControer {
             if (!Check.isNull(videoLastTime)) {
                 startTime = videoLastTime.getLastTime();
             } else {
-                startTime = DateUtils.addTime(endDate, 5);
+                startTime = DateUtils.addTime(endDate, 72);
             }
             Map<String, Object> requestMap = new HashMap<>();
             requestMap.put("startTime", DateUtils.formatDate(startTime, "yyyy-MM-dd HH:mm:ss"));

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

@@ -0,0 +1,37 @@
+package cn.com.ctop.kuaishou.modules.ai.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 快手组级别加速探索执行记录
+ * @author jeecg-boot
+ * @date   2021-03-10
+ * @version V1.0
+ */
+@Data
+@TableName("ctop_kuaishou_group_speed_explore_log")
+public class KuaishouGroupSpeedExploreLog {
+
+	/**id*/
+	@TableId(type = IdType.AUTO)
+	private Long id;
+	/**accountId*/
+	private Long accountId;
+	/**accountExploreId*/
+	private Long accountExploreId;
+	/**unitId*/
+	private Long unitId;
+	/**status*/
+	private Integer status;
+	/**message*/
+	private String message;
+	/**createTime*/
+	private Date createTime;
+	/**updateTime*/
+	private Date updateTime;
+}

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

@@ -1,7 +1,11 @@
 package cn.com.ctop.kuaishou.modules.ai.mapper;
 
 import cn.com.ctop.kuaishou.modules.ai.entity.KuaishouAccountSpeedExploreLog;
+import cn.com.ctop.kuaishou.modules.ai.vo.SpeedExploreGroupVO;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 /**
  * 快手账户加速探索触发记录信息
@@ -11,4 +15,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  */
 public interface KuaishouAccountSpeedExploreLogMapper extends BaseMapper<KuaishouAccountSpeedExploreLog> {
 
+    List<SpeedExploreGroupVO> getSpeedExploreGroupVosByParams(@Param(value = "date") String date,
+                                                              @Param(value = "accountId")Long accountId,
+                                                              @Param(value = "convertType")Integer convertType,
+                                                              @Param(value = "convertCount")Integer convertCount,
+                                                              @Param(value = "groupCount")Integer groupCount);
 }

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

@@ -0,0 +1,14 @@
+package cn.com.ctop.kuaishou.modules.ai.mapper;
+
+import cn.com.ctop.kuaishou.modules.ai.entity.KuaishouGroupSpeedExploreLog;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 快手组级别加速探索执行记录
+ * @author: jeecg-boot
+ * @date:   2021-03-10
+ * @cersion: V1.0
+ */
+public interface KuaishouGroupSpeedExploreLogMapper extends BaseMapper<KuaishouGroupSpeedExploreLog> {
+
+}

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

@@ -2,4 +2,48 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="cn.com.ctop.kuaishou.modules.ai.mapper.KuaishouAccountSpeedExploreLogMapper">
 
+    <select id="getSpeedExploreGroupVosByParams"
+            resultType="cn.com.ctop.kuaishou.modules.ai.vo.SpeedExploreGroupVO">
+        select *from (select report.account_id,
+                report.unit_id,
+                report.campaign_id,
+                report.charge,
+                report.activation,
+                report.bclick,
+                report.form_count,
+                report.event_pay,
+        <if test="convertType=180">
+            (case when activation=0 then 0 else round(report.charge/report.activation,2) end)as account,
+        </if>
+        <if test="convertType=2">
+            (case when bclick=0 then 0 else round(report.charge/report.bclick,2) end)as account,
+        </if>
+        <if test="convertType=53">
+            (case when form_count=0 then 0 else round(report.charge/report.form_count,2) end)as account,
+        </if>
+        <if test="convertType=190">
+            (case when event_pay=0 then 0 else round(report.charge/report.event_pay,2) end)as account,
+        </if>
+        round(g.cpa_bid/1000,2) as cpaBid
+         from ctop_kuaishou_group g
+                  left join ctop_kuaishou_report_daily_group report
+                            on report.unit_id = g.unit_id and report.stat_date = #{date}
+         where g.study_status = 1
+           and g.group_create_time like '2021-03-10%'
+           and g.account_id = #{accountId}
+           and report.account_id is not null
+        <if test="convertType=180">
+            and report.activation >= #{convertCount}
+        </if>
+        <if test="convertType=2">
+            and report.bclick >= #{convertCount}
+        </if>
+        <if test="convertType=53">
+            and report.form_count >= #{convertCount}
+        </if>
+        <if test="convertType=190">
+            and report.event_pay >= #{convertCount}
+        </if>) a
+where a.cpaBid>a.activation_account order by a.account limit #{groupCount}
+    </select>
 </mapper>

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

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

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

@@ -3,6 +3,8 @@ package cn.com.ctop.kuaishou.modules.ai.service;
 import cn.com.ctop.kuaishou.modules.ai.entity.AiKuaishouAdvertiserStrategy;
 import com.baomidou.mybatisplus.extension.service.IService;
 
+import java.util.Map;
+
 /**
  * @Description: 快手账户策略设置信息表
  * @Author: jeecg-boot
@@ -13,4 +15,5 @@ public interface IAiKuaishouAdvertiserStrategyService extends IService<AiKuaisho
 
     AiKuaishouAdvertiserStrategy getByAccountId(Long accountId);
 
+    Map<String, Object> testCreate(Long accountId);
 }

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

@@ -0,0 +1,14 @@
+package cn.com.ctop.kuaishou.modules.ai.service;
+
+import cn.com.ctop.kuaishou.modules.ai.entity.KuaishouGroupSpeedExploreLog;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * @Description: 快手组级别加速探索执行记录
+ * @Author: jeecg-boot
+ * @Date:   2021-03-10
+ * @Version: V1.0
+ */
+public interface IKuaishouGroupSpeedExploreLogService extends IService<KuaishouGroupSpeedExploreLog> {
+
+}

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

@@ -1,12 +1,22 @@
 package cn.com.ctop.kuaishou.modules.ai.service.impl;
 
+import cn.com.ctop.common.module.entity.UserAllocation;
+import cn.com.ctop.common.module.service.IUserAllocationService;
+import cn.com.ctop.common.module.utils.HttpUtils;
+import cn.com.ctop.common.module.utils.ResultMapUtils;
+import cn.com.ctop.common.module.utils.StatusCode;
 import cn.com.ctop.kuaishou.modules.ai.entity.AiKuaishouAdvertiserStrategy;
 import cn.com.ctop.kuaishou.modules.ai.mapper.AiKuaishouAdvertiserStrategyMapper;
 import cn.com.ctop.kuaishou.modules.ai.service.IAiKuaishouAdvertiserStrategyService;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.HashMap;
+import java.util.Map;
+
 /**
  * 快手账户策略设置信息表
  * @author jeecg-boot
@@ -15,7 +25,10 @@ import org.springframework.stereotype.Service;
  */
 @Service
 public class AiKuaishouAdvertiserStrategyServiceImpl extends ServiceImpl<AiKuaishouAdvertiserStrategyMapper, AiKuaishouAdvertiserStrategy> implements IAiKuaishouAdvertiserStrategyService {
-
+    public static final String TEST_CREATIVE_URL= "http://139.186.27.96:31012/ai_historical_missing_material";
+    public static final String TEST_PROGRAM_CREATIVE_URL= "http://139.186.27.96:31012/ai_programme_new_material";
+    @Autowired
+    private IUserAllocationService userAllocationService;
     @Override
     public AiKuaishouAdvertiserStrategy getByAccountId(Long accountId) {
         QueryWrapper<AiKuaishouAdvertiserStrategy>queryWrapper =new QueryWrapper<>();
@@ -24,4 +37,39 @@ public class AiKuaishouAdvertiserStrategyServiceImpl extends ServiceImpl<AiKuais
         queryWrapper.last("limit 1");
         return this.getOne(queryWrapper);
     }
+
+    @Override
+    public Map<String, Object> testCreate(Long accountId) {
+        Map<String,Object>result = new HashMap<>();
+        if(null == accountId||accountId == 0){
+            ResultMapUtils.setResultMap(result, StatusCode.COMMON_PARAM_ERROR);
+            return result;
+        }
+        AiKuaishouAdvertiserStrategy aiKuaishouAdvertiserStrategy = this.getByAccountId(accountId);
+        if(null == aiKuaishouAdvertiserStrategy||null == aiKuaishouAdvertiserStrategy.getStatus()||aiKuaishouAdvertiserStrategy.getStatus()!=1){
+            ResultMapUtils.setResultMap(result, StatusCode.COMMON_PARAM_ERROR);
+            return result;
+        }
+        UserAllocation allocation = userAllocationService.getByAccountId(accountId);
+        if(null == allocation){
+            ResultMapUtils.setResultMap(result, StatusCode.COMMON_PARAM_ERROR);
+            return result;
+        }
+        JSONObject params = new JSONObject();
+        params.put("account_id",accountId);
+        params.put("test_video_cnt",1);
+        String request = null;
+        //程序化
+        if(aiKuaishouAdvertiserStrategy.getOpenProgramCreate() == 1){
+            request = HttpUtils.httpPostRequest(TEST_PROGRAM_CREATIVE_URL,params,new HashMap<>());
+        }else{
+            request = HttpUtils.httpPostRequest(TEST_CREATIVE_URL, params, new HashMap<>());
+        }
+        JSONObject requestObject = JSONObject.parseObject(request);
+        String message = requestObject.getString("message");
+        Integer code = requestObject.getInteger("code");
+        result.put("code",code);
+        result.put("message",message);
+        return result;
+    }
 }

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

@@ -20,7 +20,7 @@ import java.util.concurrent.Executors;
 public class KuaiShouBatchUpdateServiceImpl implements IKuaiShouBatchUpdateService {
     @Autowired
     private IKuaiShouGroupService groupService;
-    static ExecutorService executorService = Executors.newFixedThreadPool(40);
+    static ExecutorService executorService = Executors.newFixedThreadPool(20);
     @Autowired
     private IBatchService batchService;
     @Autowired

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

@@ -7,16 +7,20 @@ import cn.com.ctop.common.module.utils.StatusCode;
 import cn.com.ctop.kuaishou.modules.ai.entity.KuaishouAccountSpeedExploreLog;
 import cn.com.ctop.kuaishou.modules.ai.mapper.KuaishouAccountSpeedExploreLogMapper;
 import cn.com.ctop.kuaishou.modules.ai.service.IKuaishouAccountSpeedExploreLogService;
+import cn.com.ctop.kuaishou.modules.ai.vo.SpeedExploreGroupVO;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
+import cn.com.ctop.kuaishou.modules.report.service.IKuaishouGroupExploreService;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.jeecg.common.util.DateUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import javax.annotation.Resource;
 import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -31,6 +35,10 @@ public class KuaishouAccountSpeedExploreLogServiceImpl extends ServiceImpl<Kuais
     private ICtopOauthTokenService tokenService;
     @Autowired
     private IKuaishouInterfaceService kuaishouInterfaceService;
+    @Autowired
+    private IKuaishouGroupExploreService kuaishouGroupExploreService;
+    @Resource
+    private KuaishouAccountSpeedExploreLogMapper kuaishouAccountSpeedExploreLogMapper;
     @Override
     public Map<String, Object> openSpeedExplore(KuaishouAccountSpeedExploreLog kuaishouAccountSpeedExploreLog) throws Exception{
         Map<String,Object> result = new HashMap<>();
@@ -57,13 +65,23 @@ public class KuaishouAccountSpeedExploreLogServiceImpl extends ServiceImpl<Kuais
         //1: 拉取账户下所有的广告组信息
         kuaishouInterfaceService.getGroupList(token, startDate, endDate);
         //2: 查询处于学习期的广告组数据
-        kuaishouInterfaceService.getAdvertiserGroupReportDaily(token,startDate,endDate);
+// TODO       kuaishouInterfaceService.getAdvertiserGroupReportDaily(token,startDate,endDate);
         //3:根据转化目标查询相应的符合条件的广告组数据
         //优化目标 2 行为数 180 激活数 53 表单数 190 付费 191 首日ROI
-        Integer convertType = kuaishouAccountSpeedExploreLog.getConvertType();
+        //查询相关符合条件的广告组数据
+        List<SpeedExploreGroupVO> speedExploreGroupVos = this.getSpeedExploreGroupVOSByParams(DateUtils.formatDate(endDate),kuaishouAccountSpeedExploreLog.getAccountId(),kuaishouAccountSpeedExploreLog.getConvertType(),kuaishouAccountSpeedExploreLog.getConvertCount(),kuaishouAccountSpeedExploreLog.getGroupCount());
+        if(null==speedExploreGroupVos||speedExploreGroupVos.isEmpty()){
+            speedExploreGroupVos.forEach(speedExploreGroupVO -> {
+                //触发加速探索逻辑
+                kuaishouGroupExploreService.unitOpenSpeedExplore(speedExploreGroupVO.getAccountId(),speedExploreGroupVO.getUnitId(),kuaishouAccountSpeedExploreLog.getGroupAccount(),kuaishouAccountSpeedExploreLog.getId());
+            });
+        }
 
 
+    }
 
+    private List<SpeedExploreGroupVO> getSpeedExploreGroupVOSByParams(String date, Long accountId, Integer convertType, Integer convertCount,Integer groupCount) {
+        return kuaishouAccountSpeedExploreLogMapper.getSpeedExploreGroupVosByParams(date,accountId,convertType,convertCount,groupCount);
     }
 
     @Override

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

@@ -0,0 +1,18 @@
+package cn.com.ctop.kuaishou.modules.ai.service.impl;
+
+import cn.com.ctop.kuaishou.modules.ai.entity.KuaishouGroupSpeedExploreLog;
+import cn.com.ctop.kuaishou.modules.ai.mapper.KuaishouGroupSpeedExploreLogMapper;
+import cn.com.ctop.kuaishou.modules.ai.service.IKuaishouGroupSpeedExploreLogService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * 快手组级别加速探索执行记录
+ * @author jeecg-boot
+ * @date   2021-03-10
+ * @version V1.0
+ */
+@Service
+public class KuaishouGroupSpeedExploreLogServiceImpl extends ServiceImpl<KuaishouGroupSpeedExploreLogMapper, KuaishouGroupSpeedExploreLog> implements IKuaishouGroupSpeedExploreLogService {
+
+}

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

@@ -0,0 +1,18 @@
+package cn.com.ctop.kuaishou.modules.ai.vo;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+public class SpeedExploreGroupVO {
+    private Long accountId;
+    private Long unitId;
+    private Long campaignId;
+    private BigDecimal charge;
+    private Long activation;
+    private Long bclick;
+    private Long formCount;
+    private Long eventPay;
+    private BigDecimal account;
+}

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

@@ -16,6 +16,7 @@ import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouCampaignMapper;
 import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouGroupMapper;
 import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouTargetingTagsMapper;
 import cn.com.ctop.kuaishou.modules.batch.service.*;
+import cn.com.ctop.kuaishou.modules.report.service.IEtlKuaiShouGroupDailyReportService;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -875,6 +876,8 @@ public class BatchController {
         return result;
     }
 
+    @Autowired
+    private IEtlKuaiShouGroupDailyReportService shouGroupDailyReportService;
 
     /**
      * 批量修改广告组状态
@@ -913,6 +916,9 @@ public class BatchController {
                                     failJson.put("campaignName", group.getUnitName());
                                 }
                                 failArr.add(failJson);
+                            } else {
+                                //更新数据状态
+                                shouGroupDailyReportService.updateStatus(accountId,unitId,putStatus);
                             }
                         }
                     }

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

@@ -0,0 +1,240 @@
+package cn.com.ctop.kuaishou.modules.batch.controller;
+
+import cn.com.ctop.common.module.entity.CtopOauthToken;
+import cn.com.ctop.common.module.service.ICtopOauthTokenService;
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouCreative;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouGroup;
+import cn.com.ctop.kuaishou.modules.batch.service.*;
+import cn.com.ctop.kuaishou.modules.report.entity.EtlKuaiShouGroupDailyReport;
+import cn.com.ctop.kuaishou.modules.report.entity.ProjectMember;
+import cn.com.ctop.kuaishou.modules.report.service.IEtlKuaiShouGroupDailyReportService;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import org.jeecg.common.api.vo.Result;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+@RestController
+@RequestMapping("/kuaishou/dingpan")
+public class DingPanController {
+    @Autowired
+    private ICtopOauthTokenService oauthTokenService;
+    @Autowired
+    private IKuaishouInterfaceService interfaceService;
+    @Autowired
+    private IKuaiShouGroupService groupService;
+    @Autowired
+    private IKuaiShouCreativeService creativeService;
+    @Autowired
+    private IBatchService batchService;
+    @Autowired
+    private IKuaiShouUpdateService updateService;
+    @Autowired
+    private IKuaiShouGroupTemplateService groupTemplateService;
+    @Autowired
+    private IEtlKuaiShouGroupDailyReportService etlKuaiShouGroupDailyReportService;
+
+    /**
+     * 获取创意监测链接
+     *
+     * @param accountId
+     * @param unitId
+     * @return
+     */
+    @GetMapping(value = "/getClickTrackUrlByUnitId")
+    public Result<String> getClickTrackUrlByUnitId(Long accountId, Long unitId) {
+        Result<String> result = new Result<>();
+        try {
+            if (Check.isNull(accountId)) {
+                throw new Exception("请输入账户id");
+            }
+            if (Check.isNull(unitId)) {
+                throw new Exception("请输入组id");
+            }
+            CtopOauthToken token = oauthTokenService.getTokenByAccountId(accountId);
+            if (Check.isNull(token)) {
+                throw new Exception("未获取到账户授权信息");
+            }
+            groupService.getCreativeByUnit(token.getAccessToken(), token.getAccountId(), unitId);
+            String clickTrackUr = creativeService.getClickTrackUrl(accountId, unitId);
+            result.setSuccess(true);
+            result.setResult(clickTrackUr);
+
+        } catch (Exception e) {
+            result.setSuccess(false);
+            result.setMessage(e.getMessage());
+        }
+        return result;
+    }
+
+
+    /**
+     * 修改监测链接
+     *
+     * @param accountId
+     * @param unitId
+     * @param clickTrackUr
+     * @return
+     */
+    @GetMapping(value = "/updateClickTrackUrlByUnitId")
+    public Result<String> updateClickTrackUrlByUnitId(Long accountId, Long unitId, String clickTrackUr) {
+        Result<String> result = new Result<>();
+        try {
+            if (Check.isNull(accountId)) {
+                throw new Exception("请输入账户id");
+            }
+            if (Check.isNull(unitId)) {
+                throw new Exception("请输入组id");
+            }
+            if (Check.isNull(clickTrackUr)) {
+                throw new Exception("请输入监测链接");
+            }
+            CtopOauthToken token = oauthTokenService.getTokenByAccountId(accountId);
+            if (Check.isNull(token)) {
+                throw new Exception("未获取到账户授权信息");
+            }
+            List<KuaiShouCreative> creatives = creativeService.getCreativeListByAccountIdAndUnitId(accountId, unitId);
+            if (Check.isNull(creatives)) {
+                throw new Exception("此组下暂无创意");
+            }
+            for (KuaiShouCreative creative : creatives) {
+                JSONObject json = new JSONObject();
+                json.put("creativeId", creative.getCreativeId());
+                if (creative.getCreativeMaterialType() == 1) {
+                    json.put("clickTrackUrl", clickTrackUr);
+                } else if (creative.getCreativeMaterialType() == 4) {
+                    json.put("impressionUrl", clickTrackUr);
+                    json.put("clickTrackUrl", clickTrackUr);
+                }
+                batchService.updateCreative(json, token);
+            }
+            result.setSuccess(true);
+            result.setResult("修改成功");
+        } catch (Exception e) {
+            result.setSuccess(false);
+            result.setMessage(e.getMessage());
+        }
+        return result;
+    }
+
+
+    @GetMapping(value = "/updateTemplate")
+    public Result<String> updateTemplate(Long accountId, Long unitId, Long templateId) {
+        Result<String> result = new Result<>();
+        try {
+            if (Check.isNull(accountId)) {
+                throw new Exception("请输入账户id");
+            }
+            if (Check.isNull(unitId)) {
+                throw new Exception("请输入组id");
+            }
+            if (Check.isNull(templateId)) {
+                throw new Exception("请输入模板Id");
+            }
+            CtopOauthToken token = oauthTokenService.getTokenByAccountId(accountId);
+            if (Check.isNull(token)) {
+                throw new Exception("未获取到账户授权信息");
+            }
+            groupService.getGroupByUnitId(token.getAccessToken(), token.getAccountId(), unitId);
+            KuaiShouGroup kuaiShouGroup = groupService.selectGroupByUnitId(accountId, unitId);
+            if (Check.isNull(kuaiShouGroup)) {
+                throw new Exception("组信息为空");
+            }
+            Integer sceneId = JSONArray.parseArray(kuaiShouGroup.getSceneId()).getInteger(0);
+            JSONObject unitJson = new JSONObject();
+            unitJson.put("advertiser_id", accountId);
+            unitJson.put("unit_id", unitId);
+            if (sceneId != 5) {
+                unitJson.put("template_id", templateId);
+            } else {
+                JSONObject unionJson = groupTemplateService.getUnionJson(templateId);
+                if (Check.isNullMap(unionJson)) {
+                    throw new Exception("根据定向模板未获取到相关信息");
+                }
+                unitJson.put("target", unionJson);
+            }
+            JSONObject jsonObject = updateService.updateUnit(token.getAccessToken(), unitJson);
+            Integer code = jsonObject.getInteger("code");
+            if (code == 0) {
+                result.setSuccess(true);
+                result.setMessage("修改成功");
+            } else {
+                result.setSuccess(false);
+                result.setMessage(jsonObject.getString("message"));
+            }
+        } catch (Exception e) {
+            result.setSuccess(false);
+            result.setMessage(e.getMessage());
+        }
+        return result;
+    }
+
+
+    /**
+     * 修改出价
+     *
+     * @param accountId
+     * @param unitId
+     * @param bid
+     * @param bidType
+     * @return
+     */
+    @GetMapping(value = "/updateBid")
+    public Result<String> updateBid(Long accountId, Long unitId, Long bid, Integer bidType) {
+        Result<String> result = new Result<>();
+        try {
+            if (Check.isNull(accountId)) {
+                throw new Exception("请输入账户id");
+            }
+            if (Check.isNull(unitId)) {
+                throw new Exception("请输入组id");
+            }
+            if (Check.isNull(bidType)) {
+                throw new Exception("请输入出价类型");
+            }
+            if (Check.isNull(bid)) {
+                throw new Exception("请输入出价");
+            }
+            CtopOauthToken token = oauthTokenService.getTokenByAccountId(accountId);
+            if (Check.isNull(token)) {
+                throw new Exception("未获取到账户授权信息");
+            }
+
+            JSONObject unitJson = new JSONObject();
+            unitJson.put("advertiser_id", accountId);
+            unitJson.put("unit_id", unitId);
+            if (bidType == 2) {
+                unitJson.put("bid", bid);
+            } else if (bidType == 10) {
+                unitJson.put("cpa_bid", bid);
+            }
+            JSONObject jsonObject = updateService.updateUnit(token.getAccessToken(), unitJson);
+            Integer code = jsonObject.getInteger("code");
+            if (code == 0) {
+                QueryWrapper<EtlKuaiShouGroupDailyReport> wrapper = new QueryWrapper<>();
+                wrapper.eq("account_id", accountId);
+                wrapper.eq("unit_id", unitId);
+                EtlKuaiShouGroupDailyReport etl = new EtlKuaiShouGroupDailyReport();
+                etl.setBid(bid);
+                etlKuaiShouGroupDailyReportService.update(etl, wrapper);
+                result.setSuccess(true);
+                result.setMessage("修改成功");
+            } else {
+                result.setSuccess(false);
+                result.setMessage(jsonObject.getString("message"));
+            }
+        } catch (Exception e) {
+            result.setSuccess(false);
+            result.setMessage(e.getMessage());
+        }
+        return result;
+    }
+
+
+}

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

@@ -1,6 +1,5 @@
 package cn.com.ctop.kuaishou.modules.batch.controller;
 
-import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
 import cn.com.ctop.common.module.utils.HttpUtils;
 import cn.com.ctop.common.module.vo.KuaishouReportAccountDailyDTOEntity;
@@ -27,8 +26,6 @@ import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
 import java.io.OutputStream;
 import java.util.Date;
-import java.util.HashMap;
-import java.util.Map;
 
 /**
  * @author yumeng
@@ -46,39 +43,6 @@ public class KuaiShouController {
     @Autowired
     private IKuaishouReportDailyAccountService accountService;
 
-    @RequestMapping("report")
-    public Map<String, Object> getReport(String accountId, String startDate, String endDate, Integer type, String temporalGranularity) {
-        Map<String, Object> result = new HashMap<>();
-        CtopOauthToken token = tokenService.getOauthTokenByAccountId(accountId);
-        if (null != type) {
-            if (type == 1) {
-                //广告主
-
-            } else if (type == 2) {
-                //广告组
-                if (null != temporalGranularity && "hourly".equals(temporalGranularity)) {
-                    result.put("data", kuaishouInterfaceService.getGroupHourlyReport(token.getAccessToken(), token.getAccountId(), startDate, endDate, 500, 1));
-                } else {
-                    result.put("data", kuaishouInterfaceService.getGroupDailyReport(token.getAccessToken(), token.getAccountId(), startDate, endDate, 500, 1));
-                }
-            } else if (type == 3) {
-                //广告计划
-                if (null != temporalGranularity && "hourly".equals(temporalGranularity)) {
-                    result.put("data", kuaishouInterfaceService.getCampaignHourlyReport(token.getAccessToken(), token.getAccountId(), startDate, endDate, 500, 1));
-                } else {
-                    result.put("data", kuaishouInterfaceService.getCampaignDailyReport(token.getAccessToken(), token.getAccountId(), startDate, endDate, 500, 1));
-                }
-            } else {
-                //广告创意
-                if (null != temporalGranularity && "hourly".equals(temporalGranularity)) {
-                    result.put("data", kuaishouInterfaceService.getCreativeHourlyReport(token.getAccessToken(), token.getAccountId(), startDate, endDate, 500, 1));
-                } else {
-                    result.put("data", kuaishouInterfaceService.getCreativeDailyReport(token.getAccessToken(), token.getAccountId(), startDate, endDate, 500, 1));
-                }
-            }
-        }
-        return result;
-    }
 
     @RequestMapping("/getKuaishouProjectInfo")
     public Result<PageInfo<ProjectAccountDTO>> getKuaishouProjectInfo(@RequestBody KuaishouInfoDTO dto) {

+ 4 - 3
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/KuaiShouCampaignMapper.java

@@ -1,7 +1,6 @@
 package cn.com.ctop.kuaishou.modules.batch.mapper;
 
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouCampaign;
-import com.alibaba.fastjson.JSONArray;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Param;
 
@@ -17,7 +16,9 @@ public interface KuaiShouCampaignMapper extends BaseMapper<KuaiShouCampaign> {
 
     void replaceBatch(@Param(value = "campaigns") List<KuaiShouCampaign> campaigns);
 
-    List<Long> queryIdsByPutStatus(Long accountId,String putStatus);
+    List<Long> queryIdsByPutStatus(Long accountId, String putStatus);
 
-    JSONArray queryCampaignIdByAccountId(Long accountId);
+    List<Long> queryCampaignIdByAccountId(Long accountId);
+
+    Integer getNewDataByAccountIdAndDate(@Param("accountId") Long accountId, @Param("statDate") String statDate);
 }

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

@@ -28,4 +28,10 @@ public interface KuaiShouCreativeMapper extends BaseMapper<KuaiShouCreative> {
     List<KuaiShouCreative> queryCreativeInfoByCampaignId(@Param("accountId") Long accountId, @Param("campaignId") Long campaignId);
 
     List<Long> getCreativeIds(@Param("accountId") Long accountId);
+
+    Integer getNewDataByAccountIdAndDate(Long accountId, String statDate);
+
+    Integer getRejectedCountsforAccountId(Long accountId);
+
+    String getClickTrackUrl(@Param("accountId") Long accountId, @Param("unitId") Long unitId);
 }

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

@@ -1,9 +1,9 @@
 package cn.com.ctop.kuaishou.modules.batch.mapper;
 
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouGroup;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Param;
-import org.jeecg.common.api.vo.Result;
 
 import java.math.BigDecimal;
 import java.util.List;
@@ -33,4 +33,8 @@ public interface KuaiShouGroupMapper extends BaseMapper<KuaiShouGroup> {
     Integer queryToDayBuiltCount(@Param("accountId") Long accountId, @Param("date") String date);
 
     void deleteByAccountId(@Param("accountId") Long accountId);
+
+    Integer getNewDataByAccountIdAndDate(Long accountId, String statDate);
+
+    List<JSONObject> getUnitListByMapAndAccountId(@Param("unitIds") Map<Long, Long> unitMap, @Param("accountId") Long accountId);
 }

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

@@ -32,4 +32,12 @@ public interface KuaiShouVideoGetMapper extends BaseMapper<KuaiShouVideoGet> {
     void etlVideoBaseInfoByStaDate(@Param("statDate") String statDate);
 
     List<JSONObject> getVideoInfoByPhotoIds(@Param("photoIdList") List<Long> photoIdList);
+
+    Integer getTotalCountByAccount(@Param("accountId") Long accountId);
+
+    Integer getTotalCountByAccountAndStatDate(@Param("accountId") Long accountId, @Param("statDate") String statDate);
+
+    Integer getEffectiveCountByAccountId(Long accountId);
+
+    Integer getHotMoneyCountByAccountId(Long accountId);
 }

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

@@ -47,4 +47,11 @@
         ctop_kuaishou_campaign
         WHERE account_id = #{accountId}
     </select>
+    <select id="getNewDataByAccountIdAndDate" resultType="java.lang.Integer">
+     select
+     count(1)
+     from ctop_kuaishou_campaign
+     where account_id = #{accountId}
+     and DATE_FORMAT(put_create_time,'%Y-%m-%d') = #{statDate}
+    </select>
 </mapper>

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

@@ -147,5 +147,27 @@
      where  account_id = #{accountId}
      and  status = 42
     </select>
+    <select id="getNewDataByAccountIdAndDate" resultType="java.lang.Integer">
+     select
+     count(1)
+     from ctop_kuaishou_creative
+     where account_id = #{accountId}
+     and DATE_FORMAT(creative_create_time,'%Y-%m-%d') = #{statDate}
+    </select>
+
+    <select id="getRejectedCountsforAccountId" resultType="java.lang.Integer">
+     select  count(1)
+     from ctop_kuaishou_creative
+     where  account_id = #{accountId}
+     and  status = 42
+    </select>
+    <select id="getClickTrackUrl" resultType="java.lang.String">
+        select  click_track_url  from ctop_kuaishou_creative
+        where  account_id = #{accountId}
+        and unit_id = #{unitId}
+        order by creative_create_time desc
+        limit 1
+
+    </select>
 
 </mapper>

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

@@ -115,7 +115,7 @@
 
     <select id="queryUnitInfoByAccountId" resultType="cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouGroup">
         SELECT
-        account_id,campaign_id,unit_id,unit_id
+        account_id,campaign_id,unit_id
         FROM ctop_kuaishou_group
         WHERE account_id = #{accountId}
     </select>
@@ -139,9 +139,37 @@
           AND create_channel =1
           AND LOCATE(#{date}, group_create_time)
     </select>
+    <select id="getNewDataByAccountIdAndDate" resultType="java.lang.Integer">
+     select
+     count(1)
+     from ctop_kuaishou_group
+     where account_id = #{accountId}
+     and DATE_FORMAT(group_create_time,'%Y-%m-%d') = #{statDate}
+    </select>
+
     <delete id="deleteByAccountId">
         delete from ctop_kuaishou_group
         where  account_id = #{accountId}
     </delete>
 
+    <select id="getUnitListByMapAndAccountId" resultType="com.alibaba.fastjson.JSONObject">
+        select
+        unit_id as unitId,
+        put_status as unitStatus,
+        bid_type as bidType,
+        (case when bid_type = 2
+        then bid
+        when bid_type = 10
+        then cpa_bid
+        else 0
+        end
+        ) as bid
+        from ctop_kuaishou_group
+        where account_id = #{accountId}
+        and unit_id in
+        <foreach collection="unitIds" item="unitIds" separator="," open="(" close=")">
+            #{unitIds}
+        </foreach>
+    </select>
+
 </mapper>

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

@@ -166,4 +166,58 @@
         and signature is not null
         group by photo_id
     </select>
+    <select id="getTotalCountByAccount" resultType="java.lang.Integer">
+        select
+        count(distinct signature)
+        from ctop_kuaishou_video_get
+        where  account_id = #{accountId}
+    </select>
+    <select id="getTotalCountByAccountAndStatDate" resultType="java.lang.Integer">
+        SELECT
+    	count(DISTINCT signature)
+        FROM
+	    ctop_kuaishou_video_get
+        WHERE
+	    account_id = #{accountId}
+        AND DATE_FORMAT(stat_date, '%Y-%m-%d') = #{statDate}
+    </select>
+    <select id="getEffectiveCountByAccountId" resultType="java.lang.Integer">
+        SELECT
+        count(1)
+        FROM
+        (
+        SELECT
+        signature
+        FROM
+        ctop_kuaishou_video_get
+        WHERE
+        account_id = #{accountId}
+        GROUP BY
+        signature
+        ) t1
+        LEFT JOIN ctop_kuaishou_video_etl_info t2 ON t1.signature = t2.video_code
+        WHERE
+        t2.effect_date IS NOT NULL
+        AND t2.effect_day_num &lt;= 7
+
+    </select>
+    <select id="getHotMoneyCountByAccountId" resultType="java.lang.Integer">
+        SELECT
+        count(1)
+        FROM
+        (
+        SELECT
+        signature
+        FROM
+        ctop_kuaishou_video_get
+        WHERE
+        account_id = #{accountId}
+        GROUP BY
+        signature
+        ) t1
+        LEFT JOIN ctop_kuaishou_video_etl_info t2 ON t1.signature = t2.video_code
+        WHERE
+        t2.faddish_date is not null
+        and faddish_day_num &lt;=14
+    </select>
 </mapper>

+ 3 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaiShouCampaignService.java

@@ -18,7 +18,9 @@ public interface IKuaiShouCampaignService extends IService<KuaiShouCampaign> {
 
     List<JSONArray> getJsonArrByAccount(Long accountId, int idSize);
 
-    JSONArray queryCampaignIdByAccountId(Long accountId);
+    List<Long> queryCampaignIdByAccountId(Long accountId);
 
     KuaiShouCampaign getCampaignByAccountAndCampaign(Long accountId, Long campaignId);
+
+    Integer getNewDataByAccountIdAndDate(Long accountId, String statDate);
 }

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

@@ -64,4 +64,10 @@ public interface IKuaiShouCreativeService extends IService<KuaiShouCreative> {
     String convertMoString(String sMo);
 
     List<KuaiShouCreative> getByParams(Long accountId, String photoId, Integer putStatus);
+
+    Integer getNewDataByAccountIdAndDate(Long accountId, String statDate);
+
+    String getClickTrackUrl(Long accountId, Long unitId);
+
+    List<KuaiShouCreative> getCreativeListByAccountIdAndUnitId(Long accountId, Long unitId);
 }

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

@@ -1,10 +1,11 @@
 package cn.com.ctop.kuaishou.modules.batch.service;
 
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouGroup;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.service.IService;
-import org.jeecg.common.api.vo.Result;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * @Description: 广告组信息
@@ -41,4 +42,8 @@ public interface IKuaiShouGroupService extends IService<KuaiShouGroup> {
     Integer queryToDayBuiltCount(Long accountId);
 
     void deleteByAccountId(Long accountId);
+
+    Integer getNewDataByAccountIdAndDate(Long accountId, String statDate);
+
+    Map<Long, JSONObject> getBidMapByMap(Long accountId, Map<Long, Long> unitIdMap);
 }

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

@@ -41,4 +41,11 @@ public interface IKuaiShouVideoGetService extends IService<KuaiShouVideoGet> {
 
     List<KuaiShouVideoGet> getVideoInfoGroupBySignature(String date);
 
+    Integer getTotalCountByAccount(Long accountId);
+
+    Integer getTotalCountByAccountAndStatDate(Long accountId, String statDate);
+
+    Integer getEffectiveCountByAccountId(Long accountId);
+
+    Integer getHotMoneyCountByAccountId(Long accountId);
 }

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

@@ -60,7 +60,6 @@ public interface IKuaishouInterfaceService {
      * @param pageNum
      * @return
      */
-    KuaishouResult<KuaishouReportDailyGroup> getGroupDailyReport(String accessToken, Long advertiserId, String startDate, String endDate, int pageSize, int pageNum);
 
     /**
      * 组时报
@@ -273,7 +272,7 @@ public interface IKuaishouInterfaceService {
      * @param startDate
      * @param endDate
      */
-    void getAdvertiserReportDaily(CtopOauthToken token, Date startDate, Date endDate);
+    void getAdvertiserReportDaily(CtopOauthToken token, Date startDate, Date endDate, String reportDims);
 
     /**
      * 获取计划分天报表
@@ -284,14 +283,6 @@ public interface IKuaishouInterfaceService {
      */
     void getAdvertiserCampaignReportDaily(CtopOauthToken token, Date startDate, Date endDate);
 
-    /**
-     * 获取广告计划分天报表 暂停使用
-     *
-     * @param token
-     * @param startDate
-     * @param endDate
-     */
-    void getAdvertiserGroupReportDaily(CtopOauthToken token, Date startDate, Date endDate);
 
     /**
      * 获取创意分天报表 暂停使用

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

@@ -29,4 +29,6 @@ public interface IKuaishouVideoRelateCreativesService extends IService<KuaishouV
     List<JSONObject> getVideoZeroListByMap(Map<String, Object> requestMap);
 
     List<JSONObject> getHistoryTopVideoList(Map<String, Object> requestMap);
+
+    void videoRelateCreatives(Long accountId);
 }

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

@@ -61,7 +61,7 @@ public class KuaiShouCampaignServiceImpl extends ServiceImpl<KuaiShouCampaignMap
     }
 
     @Override
-    public JSONArray queryCampaignIdByAccountId(Long accountId) {
+    public List<Long> queryCampaignIdByAccountId(Long accountId) {
         return campaignMapper.queryCampaignIdByAccountId(accountId);
     }
 
@@ -76,4 +76,9 @@ public class KuaiShouCampaignServiceImpl extends ServiceImpl<KuaiShouCampaignMap
         return campaign;
     }
 
+    @Override
+    public Integer getNewDataByAccountIdAndDate(Long accountId, String statDate) {
+        return campaignMapper.getNewDataByAccountIdAndDate(accountId, statDate);
+    }
+
 }

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

@@ -14,7 +14,6 @@ import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
@@ -273,18 +272,36 @@ public class KuaiShouCreativeServiceImpl extends ServiceImpl<KuaiShouCreativeMap
 
     @Override
     public List<KuaiShouCreative> getByParams(Long accountId, String photoId, Integer putStatus) {
-        QueryWrapper<KuaiShouCreative>queryWrapper =new QueryWrapper<>();
-        if(null!=accountId&&accountId!=0){
-            queryWrapper.eq("account_id",accountId);
+        QueryWrapper<KuaiShouCreative> queryWrapper = new QueryWrapper<>();
+        if (null != accountId && accountId != 0) {
+            queryWrapper.eq("account_id", accountId);
         }
-        if(null!=photoId&&!"".equals(photoId.trim())){
-            queryWrapper.eq("photo_id",photoId);
+        if (null != photoId && !"".equals(photoId.trim())) {
+            queryWrapper.eq("photo_id", photoId);
         }
-        if(null!=putStatus&&putStatus!=0){
-            queryWrapper.eq("put_status",putStatus);
+        if (null != putStatus && putStatus != 0) {
+            queryWrapper.eq("put_status", putStatus);
         }
         return this.list(queryWrapper);
     }
 
+    @Override
+    public Integer getNewDataByAccountIdAndDate(Long accountId, String statDate) {
+        return kuaiShouCreativeMapper.getNewDataByAccountIdAndDate(accountId, statDate);
+    }
+
+    @Override
+    public String getClickTrackUrl(Long accountId, Long unitId) {
+        return kuaiShouCreativeMapper.getClickTrackUrl(accountId, unitId);
+    }
+
+    @Override
+    public List<KuaiShouCreative> getCreativeListByAccountIdAndUnitId(Long accountId, Long unitId) {
+        QueryWrapper<KuaiShouCreative> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("account_id", accountId);
+        queryWrapper.eq("unit_id", unitId);
+        return this.list(queryWrapper);
+    }
+
 
 }

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

@@ -4,12 +4,7 @@ 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.batch.entity.KuaiShouAppInfo;
-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.KuaiShouGroupTarget;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouSchedule;
+import cn.com.ctop.kuaishou.modules.batch.entity.*;
 import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouAppInfoMapper;
 import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouGroupMapper;
 import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouGroupTargetMapper;
@@ -27,11 +22,7 @@ import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 
@@ -149,6 +140,29 @@ public class KuaiShouGroupServiceImpl extends ServiceImpl<KuaiShouGroupMapper, K
         groupMapper.deleteByAccountId(accountId);
     }
 
+    @Override
+    public Integer getNewDataByAccountIdAndDate(Long accountId, String statDate) {
+        return groupMapper.getNewDataByAccountIdAndDate(accountId, statDate);
+    }
+
+    @Override
+    public Map<Long, JSONObject> getBidMapByMap(Long accountId, Map<Long, Long> unitIdMap) {
+        Map<Long, JSONObject> unitMap = new HashMap<>();
+        if (Check.isNullMap(unitIdMap)) {
+            return unitMap;
+        }
+        List<JSONObject> unitList = groupMapper.getUnitListByMapAndAccountId(unitIdMap, accountId);
+        if (Check.isNull(unitList)) {
+            return unitMap;
+        }
+        for (int i = 0; i < unitList.size(); i++) {
+            JSONObject jsonObject = unitList.get(i);
+            unitMap.put(jsonObject.getLong("unitId"), jsonObject);
+        }
+
+        return unitMap;
+    }
+
 
     @Override
     public void getGroupByUnitId(String accessToken, Long accountId, Long unitId) {

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

@@ -245,4 +245,24 @@ public class KuaiShouVideoGetServiceImpl extends ServiceImpl<KuaiShouVideoGetMap
         queryWrapper.groupBy("signature");
         return this.list(queryWrapper);
     }
+
+    @Override
+    public Integer getTotalCountByAccount(Long accountId) {
+        return videoGetMapper.getTotalCountByAccount(accountId);
+    }
+
+    @Override
+    public Integer getTotalCountByAccountAndStatDate(Long accountId, String statDate) {
+        return videoGetMapper.getTotalCountByAccountAndStatDate(accountId, statDate);
+    }
+
+    @Override
+    public Integer getEffectiveCountByAccountId(Long accountId) {
+        return videoGetMapper.getEffectiveCountByAccountId(accountId);
+    }
+
+    @Override
+    public Integer getHotMoneyCountByAccountId(Long accountId) {
+        return videoGetMapper.getHotMoneyCountByAccountId(accountId);
+    }
 }

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

@@ -132,7 +132,13 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
 
     @Override
     public void getAdvertiserReportHourly(CtopOauthToken token, Date startDate, Date endDate) {
-        getAdvertiserReportHourlyByPage(token, startDate, endDate, 1);
+        try {
+            Thread.sleep(200L);
+            getAdvertiserReportHourlyByPage(token, startDate, endDate, 1);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
     }
 
 
@@ -145,7 +151,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
         param.put("end_date", DateUtils.formatDate(endDate));
         param.put("advertiser_id", token.getAccountId());
         param.put("temporal_granularity", "HOURLY");
-        param.put("page_size", 500);
+        param.put("page_size", 2000);
         param.put("page", page);
         String result = HttpUtils.httpPostRequest(url, param, headers);
         JSONObject resultJson = JSONObject.parseObject(result);
@@ -159,19 +165,20 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
         if (null == details || details.size() <= 0) {
             return;
         }
+        List<KuaishouReportHourlyAccount> addList = 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 kuaishouReportHourlyAccount = JSONObject.toJavaObject(detailJson, KuaishouReportHourlyAccount.class);
+            KuaishouReportHourlyAccount kuaishouReportHourlyAccount = JSONObject.toJavaObject(detailJson, KuaishouReportHourlyAccount.class);
             kuaishouReportHourlyAccount.setAccountId(token.getAccountId());
             kuaishouReportHourlyAccount.setId("" + token.getAccountId() + kuaishouReportHourlyAccount.getStatDate() + kuaishouReportHourlyAccount.getStatHour());
-            kuaishouReportHourlyAccount.setCreateTime(new Date());
-            kuaishouReportHourlyAccount.setUpdateTime(new Date());
-            hourlyAccountService.saveOrUpdate(kuaishouReportHourlyAccount);
+            //  hourlyAccountService.saveOrUpdate(kuaishouReportHourlyAccount);
+            addList.add(kuaishouReportHourlyAccount);
         }
+        hourlyAccountService.replaceBatch(addList);
     }
 
 
@@ -269,14 +276,19 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
 
     }
 
-
     @Override
-    public void getAdvertiserReportDaily(CtopOauthToken token, Date startDate, Date endDate) {
-        getAccountDailyReportByPage(token, startDate, endDate, 1);
+    public void getAdvertiserReportDaily(CtopOauthToken token, Date startDate, Date endDate, String reportDims) {
+        try {
+            Thread.sleep(400L);
+            getAccountDailyReportByPage(token, startDate, endDate, 1, reportDims);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
     }
 
 
-    private void getAccountDailyReportByPage(CtopOauthToken token, Date startDate, Date endDate, int page) {
+    private void getAccountDailyReportByPage(CtopOauthToken token, Date startDate, Date endDate, int page, String reportDims) {
         String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.ACCOUNT_REPORT;
         Map<String, String> headers = new HashMap<>();
         headers.put("Content-Type", "application/json");
@@ -289,11 +301,15 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
         if (!Check.isNull(endDate)) {
             param.put("end_date", DateUtils.formatDate(endDate));
         }
-
+        if (!Check.isNull(reportDims)) {
+            JSONArray array = new JSONArray();
+            array.add(reportDims);
+            param.put("report_dims", array);
+        }
 
         param.put("advertiser_id", token.getAccountId());
         param.put("temporal_granularity", "DAILY");
-        param.put("page_size", 500);
+        param.put("page_size", 2000);
         param.put("page", page);
         String result = HttpUtils.httpPostRequest(url, param, headers);
         JSONObject resultJson = JSONObject.parseObject(result);
@@ -308,7 +324,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
             log.info("快手广告主报表信息为空=》accountId:{}", token.getAccountId());
             return;
         }
-
+        List<KuaishouReportDailyAccount> addList = new ArrayList<>();
         for (int i = 0; i < details.size(); i++) {
             JSONObject detailJson = details.getJSONObject(i);
             if (!Check.isNull(detailJson)) {
@@ -316,15 +332,19 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
                 detailJson.put("photo_comment", detailJson.getString("comment"));
                 detailJson.put("photo_like", detailJson.getString("like"));
                 detailJson.put("photo_show", detailJson.getString("show"));
-                var KuaishouReportDailyAccount = JSONObject.toJavaObject(detailJson, KuaishouReportDailyAccount.class);
+                KuaishouReportDailyAccount KuaishouReportDailyAccount = JSONObject.toJavaObject(detailJson, KuaishouReportDailyAccount.class);
                 KuaishouReportDailyAccount.setAccountId(token.getAccountId());
-                dailyAccountMapper.insertSelective(KuaishouReportDailyAccount);
+                addList.add(KuaishouReportDailyAccount);
             }
         }
-        getAccountDailyReportByPage(token, startDate, endDate, page + 1);
+        if (Check.isNull(reportDims)) {
+            dailyAccountMapper.replaceBatch(addList);
+        } else {
+            dailyAccountMapper.replaceBatchAdScene(addList);
+        }
+        getAccountDailyReportByPage(token, startDate, endDate, page + 1, reportDims);
     }
 
-
     @Override
     public void getAdvertiserCampaignReportDaily(CtopOauthToken token, Date startDate, Date endDate) {
         getCampaignDailyReportByPage(token, startDate, endDate, 1);
@@ -456,7 +476,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
             campaigns.add(hourlyCampaign);
         }
         hourlyCampaignService.replaceBatch(campaigns);
-        getAdvertiserReportHourlyByPage(token, startDate, endDate, page + 1);
+        getCampaignReportHourlyByPage(token, startDate, endDate, page + 1);
     }
 
 
@@ -494,91 +514,6 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
 
 
     @Override
-    public void getAdvertiserGroupReportDaily(CtopOauthToken token, Date startDate, Date endDate) {
-        getAdvertiserGroupReportDailyByPage(token, startDate, endDate, 1);
-    }
-
-    private void getAdvertiserGroupReportDailyByPage(CtopOauthToken token, Date startDate, Date endDate, int page) {
-        log.info("获取广告组日报,accountId:{},开始时间:{},结束时间:{}", token.getAccountId(), DateUtils.formatDate(startDate), DateUtils.formatDate(endDate));
-        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<>();
-        if (!Check.isNull(startDate)) {
-            param.put("start_date", DateUtils.formatDate(startDate));
-        }
-
-        if (!Check.isNull(endDate)) {
-            param.put("end_date", DateUtils.formatDate(endDate));
-        }
-
-        param.put("advertiser_id", token.getAccountId());
-        param.put("temporal_granularity", "DAILY");
-        param.put("page_size", 500);
-        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;
-        }
-        for (int i = 0; i < details.size(); i++) {
-            var detailJson = details.getJSONObject(i);
-
-            detailJson.put("photo_share", detailJson.getString("share"));
-            detailJson.put("photo_comment", detailJson.getString("comment"));
-            detailJson.put("photo_like", detailJson.getString("like"));
-            detailJson.put("photo_show", detailJson.getString("show"));
-
-            var dailyGroup = JSONObject.toJavaObject(detailJson, KuaishouReportDailyGroup.class);
-            dailyGroup.setAccountId(token.getAccountId());
-            dailyGroupMapper.insertSelective(dailyGroup);
-        }
-        getAdvertiserGroupReportDailyByPage(token, startDate, endDate, page + 1);
-    }
-
-    @Override
-    public KuaishouResult<KuaishouReportDailyGroup> getGroupDailyReport(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<>();
-        headers.put("Content-Type", "application/json");
-        headers.put("Access-Token", accessToken);
-        Map<String, Object> param = new HashMap<>();
-        param.put("start_date", startDate);
-        param.put("end_date", endDate);
-        param.put("advertiser_id", advertiserId);
-        param.put("temporal_granularity", "DAILY");
-        param.put("page_size", pageSize);
-        param.put("page", pageNum);
-        KuaishouResult<KuaishouReportDailyGroup> kuaishouResult = null;
-        try {
-            String result = HttpUtils.httpPostRequest(url, param, headers);
-            ObjectMapper mapper = new ObjectMapper();
-            mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
-            kuaishouResult = mapper.readValue(result, new TypeReference<KuaishouResult<KuaishouReportDailyGroup>>() {
-            });
-            List<KuaishouReportDailyGroup> dailyGroups = kuaishouResult.getData().getDetails();
-            dailyGroups.forEach((dailyGroup) -> {
-                dailyGroup.setAccountId(advertiserId);
-                //  dailyGroup.setId("" + dailyGroup.getAccountId() + dailyGroup.getUnitId() + dailyGroup.getStatDate());
-                dailyGroupMapper.insertSelective(dailyGroup);
-            });
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-        return kuaishouResult;
-    }
-
-    @Override
     public void getAdvertiserGroupReportHourly(CtopOauthToken token, Date startDate, Date endDate) {
         getGroupHourlyReportByPage(token, startDate, endDate, 1);
     }
@@ -903,7 +838,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
             Date getStartDate = DateUtils.addDay(endDate, -i);
             //1: 获取广告主信息数据
             getAdvertiserReportHourly(token, getStartDate, getStartDate);
-            getAdvertiserReportDaily(token, getStartDate, getStartDate);
+            getAdvertiserReportDaily(token, getStartDate, getStartDate, "adScene");
             //2:获取广告计划信息数据
             // getAdvertiserCampaignReportHourly(token, getStartDate, getStartDate);
             //3:获取广告组信息数据
@@ -1419,6 +1354,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
     }
 
 
+    @Override
     public JSONArray getCreativeList(CtopOauthToken token, Long unitId, Date startDate, Date endDate, int timeFilterType) {
         Long advertiserId = token.getAccountId();
         String accessToken = token.getAccessToken();
@@ -2619,7 +2555,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
                     }
 
                 } else {
-                    log.error("获取账户余额失败");
+                    log.error("获取账户余额失败" + resultJson.getString("message"));
                 }
             } else {
                 log.error("获取账户余额返回为空");

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

@@ -9,6 +9,7 @@ import cn.com.ctop.common.module.utils.PropertiesUtils;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouVideoGet;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaishouVideoRelateCreatives;
 import cn.com.ctop.kuaishou.modules.batch.mapper.KuaishouVideoRelateCreativesMapper;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouVideoGetService;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouVideoRelateCreativesService;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
@@ -21,11 +22,9 @@ import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
 import java.util.ArrayList;
-import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.*;
 
 /**
  * 频库-视频关联创意数查询
@@ -175,4 +174,33 @@ public class KuaishouVideoRelateCreativesServiceImpl extends ServiceImpl<Kuaisho
     public List<JSONObject> getHistoryTopVideoList(Map<String, Object> requestMap) {
         return kuaishouVideoRelateCreativesMapper.getHistoryTopVideoList(requestMap);
     }
+
+    @Autowired
+    private IKuaiShouVideoGetService videoGetService;
+
+    @Override
+    public void videoRelateCreatives(Long accountId) {
+        List<KuaiShouVideoGet> KuaiShouVideoGets = videoGetService.selectPhotoIdsByAccountId(accountId);
+        if (!Check.isNull(KuaiShouVideoGets)) {
+            JSONArray dateList = new JSONArray();
+            JSONArray photoIds = new JSONArray();
+            Map<String, KuaiShouVideoGet> statdateMap = new HashMap<>();
+            int count = 0;
+            for (KuaiShouVideoGet video : KuaiShouVideoGets) {
+                count++;
+                if (count < 20) {
+                    photoIds.add(video.getPhotoId());
+                    statdateMap.put(video.getPhotoId(), video);
+                } else {
+                    photoIds.add(video.getPhotoId());
+                    statdateMap.put(video.getPhotoId(),video);
+                    dateList.add(photoIds);
+                    photoIds = new JSONArray();
+                    count = 0;
+                }
+            }
+            dateList.add(photoIds);
+            this.videoRelateCreatives(accountId, dateList, statdateMap);
+        }
+    }
 }

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

@@ -0,0 +1,259 @@
+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.EtlKuaiShouAccountMaterialOverview;
+import cn.com.ctop.kuaishou.modules.report.service.IEtlKuaiShouAccountMaterialOverviewService;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import 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-03-10
+ */
+@Slf4j
+@Api(tags = "清洗数据账户素材概览数据")
+@RestController
+@RequestMapping("/material/etlKuaiShouAccountMaterialOverview")
+public class EtlKuaiShouAccountMaterialOverviewController {
+    @Autowired
+    private IEtlKuaiShouAccountMaterialOverviewService etlKuaiShouAccountMaterialOverviewService;
+
+
+    @GetMapping(value = "/getMaterialOverview")
+    public Result<JSONObject> queryPageList(Long accountId, String statDate) {
+        Result<JSONObject> result = new Result<>();
+        JSONObject returnJson = etlKuaiShouAccountMaterialOverviewService.getMaterialOverview(accountId, statDate);
+        result.setSuccess(true);
+        result.setResult(returnJson);
+        return result;
+    }
+
+    /**
+     * 分页列表查询
+     *
+     * @param etlKuaiShouAccountMaterialOverview
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @AutoLog(value = "清洗数据账户素材概览数据-分页列表查询")
+    @ApiOperation(value = "清洗数据账户素材概览数据-分页列表查询", notes = "清洗数据账户素材概览数据-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<IPage<EtlKuaiShouAccountMaterialOverview>> queryPageList(EtlKuaiShouAccountMaterialOverview etlKuaiShouAccountMaterialOverview,
+                                                                           @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                                           @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                                           HttpServletRequest req) {
+        Result<IPage<EtlKuaiShouAccountMaterialOverview>> result = new Result<>();
+        QueryWrapper<EtlKuaiShouAccountMaterialOverview> queryWrapper = QueryGenerator.initQueryWrapper(etlKuaiShouAccountMaterialOverview, req.getParameterMap());
+        Page<EtlKuaiShouAccountMaterialOverview> page = new Page<EtlKuaiShouAccountMaterialOverview>(pageNo, pageSize);
+        IPage<EtlKuaiShouAccountMaterialOverview> pageList = etlKuaiShouAccountMaterialOverviewService.page(page, queryWrapper);
+        result.setSuccess(true);
+        result.setResult(pageList);
+        return result;
+    }
+
+    /**
+     * 添加
+     *
+     * @param etlKuaiShouAccountMaterialOverview
+     * @return
+     */
+    @AutoLog(value = "清洗数据账户素材概览数据-添加")
+    @ApiOperation(value = "清洗数据账户素材概览数据-添加", notes = "清洗数据账户素材概览数据-添加")
+    @PostMapping(value = "/add")
+    public Result<EtlKuaiShouAccountMaterialOverview> add(@RequestBody EtlKuaiShouAccountMaterialOverview etlKuaiShouAccountMaterialOverview) {
+        Result<EtlKuaiShouAccountMaterialOverview> result = new Result<>();
+        try {
+            etlKuaiShouAccountMaterialOverviewService.save(etlKuaiShouAccountMaterialOverview);
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+
+    /**
+     * 编辑
+     *
+     * @param etlKuaiShouAccountMaterialOverview
+     * @return
+     */
+    @AutoLog(value = "清洗数据账户素材概览数据-编辑")
+    @ApiOperation(value = "清洗数据账户素材概览数据-编辑", notes = "清洗数据账户素材概览数据-编辑")
+    @PutMapping(value = "/edit")
+    public Result<EtlKuaiShouAccountMaterialOverview> edit(@RequestBody EtlKuaiShouAccountMaterialOverview etlKuaiShouAccountMaterialOverview) {
+        Result<EtlKuaiShouAccountMaterialOverview> result = new Result<EtlKuaiShouAccountMaterialOverview>();
+        EtlKuaiShouAccountMaterialOverview etlKuaiShouAccountMaterialOverviewEntity = etlKuaiShouAccountMaterialOverviewService.getById(etlKuaiShouAccountMaterialOverview.getId());
+        if (etlKuaiShouAccountMaterialOverviewEntity == null) {
+            result.error500("未找到对应实体");
+        } else {
+            boolean ok = etlKuaiShouAccountMaterialOverviewService.updateById(etlKuaiShouAccountMaterialOverview);
+            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 {
+            etlKuaiShouAccountMaterialOverviewService.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<EtlKuaiShouAccountMaterialOverview> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
+        Result<EtlKuaiShouAccountMaterialOverview> result = new Result<>();
+        if (ids == null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        } else {
+            this.etlKuaiShouAccountMaterialOverviewService.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<EtlKuaiShouAccountMaterialOverview> queryById(@RequestParam(name = "id", required = true) String id) {
+        Result<EtlKuaiShouAccountMaterialOverview> result = new Result<>();
+        EtlKuaiShouAccountMaterialOverview etlKuaiShouAccountMaterialOverview = etlKuaiShouAccountMaterialOverviewService.getById(id);
+        if (etlKuaiShouAccountMaterialOverview == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(etlKuaiShouAccountMaterialOverview);
+            result.setSuccess(true);
+        }
+        return result;
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param response
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+        // Step.1 组装查询条件
+        QueryWrapper<EtlKuaiShouAccountMaterialOverview> queryWrapper = null;
+        try {
+            String paramsStr = request.getParameter("paramsStr");
+            if (oConvertUtils.isNotEmpty(paramsStr)) {
+                String deString = URLDecoder.decode(paramsStr, "UTF-8");
+                EtlKuaiShouAccountMaterialOverview etlKuaiShouAccountMaterialOverview = JSON.parseObject(deString, EtlKuaiShouAccountMaterialOverview.class);
+                queryWrapper = QueryGenerator.initQueryWrapper(etlKuaiShouAccountMaterialOverview, request.getParameterMap());
+            }
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+
+        //Step.2 AutoPoi 导出Excel
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        List<EtlKuaiShouAccountMaterialOverview> pageList = etlKuaiShouAccountMaterialOverviewService.list(queryWrapper);
+        //导出文件名称
+        mv.addObject(NormalExcelConstants.FILE_NAME, "清洗数据账户素材概览数据列表");
+        mv.addObject(NormalExcelConstants.CLASS, EtlKuaiShouAccountMaterialOverview.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<EtlKuaiShouAccountMaterialOverview> listEtlKuaiShouAccountMaterialOverviews = ExcelImportUtil.importExcel(file.getInputStream(), EtlKuaiShouAccountMaterialOverview.class, params);
+                etlKuaiShouAccountMaterialOverviewService.saveBatch(listEtlKuaiShouAccountMaterialOverviews);
+                return Result.ok("文件导入成功!数据行数:" + listEtlKuaiShouAccountMaterialOverviews.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("文件导入失败!");
+    }
+
+}

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

@@ -0,0 +1,266 @@
+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.EtlKuaiShouGroupDailyReport;
+import cn.com.ctop.kuaishou.modules.report.service.IEtlKuaiShouGroupDailyReportService;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import 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.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+import org.springframework.web.servlet.ModelAndView;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 快手组日报数据清洗
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2021-03-09
+ */
+@Slf4j
+@Api(tags = "快手组日报数据清洗")
+@RestController
+@RequestMapping("/etl/kuaiShouGroupDailyReport")
+public class EtlKuaiShouGroupDailyReportController {
+    @Autowired
+    private IEtlKuaiShouGroupDailyReportService etlKuaiShouGroupDailyReportService;
+
+    /**
+     * 分页列表查询
+     *
+     * @param etlKuaiShouGroupDailyReport
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @AutoLog(value = "快手组日报数据清洗-分页列表查询")
+    @ApiOperation(value = "快手组日报数据清洗-分页列表查询", notes = "快手组日报数据清洗-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<IPage<EtlKuaiShouGroupDailyReport>> queryPageList(EtlKuaiShouGroupDailyReport etlKuaiShouGroupDailyReport,
+                                                                    @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                                    @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                                    HttpServletRequest req) {
+        Result<IPage<EtlKuaiShouGroupDailyReport>> result = new Result<>();
+        QueryWrapper<EtlKuaiShouGroupDailyReport> queryWrapper = QueryGenerator.initQueryWrapper(etlKuaiShouGroupDailyReport, req.getParameterMap());
+        Page<EtlKuaiShouGroupDailyReport> page = new Page<EtlKuaiShouGroupDailyReport>(pageNo, pageSize);
+        IPage<EtlKuaiShouGroupDailyReport> pageList = etlKuaiShouGroupDailyReportService.page(page, queryWrapper);
+        result.setSuccess(true);
+        result.setResult(pageList);
+        return result;
+    }
+    @PostMapping(value = "/queryPageList")
+    public Result<Object> queryPageList(@RequestBody JSONObject request) {
+        try {
+            return etlKuaiShouGroupDailyReportService.queryPageList(request);
+        } catch (Exception e) {
+            log.error("查询异常,", e.getMessage());
+            e.printStackTrace();
+        }
+        return Result.error("查询失败");
+    }
+    /**
+     * 添加
+     *
+     * @param etlKuaiShouGroupDailyReport
+     * @return
+     */
+    @AutoLog(value = "快手组日报数据清洗-添加")
+    @ApiOperation(value = "快手组日报数据清洗-添加", notes = "快手组日报数据清洗-添加")
+    @PostMapping(value = "/add")
+    public Result<EtlKuaiShouGroupDailyReport> add(@RequestBody EtlKuaiShouGroupDailyReport etlKuaiShouGroupDailyReport) {
+        Result<EtlKuaiShouGroupDailyReport> result = new Result<>();
+        try {
+            etlKuaiShouGroupDailyReportService.save(etlKuaiShouGroupDailyReport);
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+
+    /**
+     * 编辑
+     *
+     * @param etlKuaiShouGroupDailyReport
+     * @return
+     */
+    @AutoLog(value = "快手组日报数据清洗-编辑")
+    @ApiOperation(value = "快手组日报数据清洗-编辑", notes = "快手组日报数据清洗-编辑")
+    @PutMapping(value = "/edit")
+    public Result<EtlKuaiShouGroupDailyReport> edit(@RequestBody EtlKuaiShouGroupDailyReport etlKuaiShouGroupDailyReport) {
+        Result<EtlKuaiShouGroupDailyReport> result = new Result<EtlKuaiShouGroupDailyReport>();
+        EtlKuaiShouGroupDailyReport etlKuaiShouGroupDailyReportEntity = etlKuaiShouGroupDailyReportService.getById(etlKuaiShouGroupDailyReport.getId());
+        if (etlKuaiShouGroupDailyReportEntity == null) {
+            result.error500("未找到对应实体");
+        } else {
+            boolean ok = etlKuaiShouGroupDailyReportService.updateById(etlKuaiShouGroupDailyReport);
+            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 {
+            etlKuaiShouGroupDailyReportService.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<EtlKuaiShouGroupDailyReport> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
+        Result<EtlKuaiShouGroupDailyReport> result = new Result<>();
+        if (ids == null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        } else {
+            this.etlKuaiShouGroupDailyReportService.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<EtlKuaiShouGroupDailyReport> queryById(@RequestParam(name = "id", required = true) String id) {
+        Result<EtlKuaiShouGroupDailyReport> result = new Result<>();
+        EtlKuaiShouGroupDailyReport etlKuaiShouGroupDailyReport = etlKuaiShouGroupDailyReportService.getById(id);
+        if (etlKuaiShouGroupDailyReport == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(etlKuaiShouGroupDailyReport);
+            result.setSuccess(true);
+        }
+        return result;
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param response
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+        // Step.1 组装查询条件
+        QueryWrapper<EtlKuaiShouGroupDailyReport> queryWrapper = null;
+        try {
+            String paramsStr = request.getParameter("paramsStr");
+            if (oConvertUtils.isNotEmpty(paramsStr)) {
+                String deString = URLDecoder.decode(paramsStr, "UTF-8");
+                EtlKuaiShouGroupDailyReport etlKuaiShouGroupDailyReport = JSON.parseObject(deString, EtlKuaiShouGroupDailyReport.class);
+                queryWrapper = QueryGenerator.initQueryWrapper(etlKuaiShouGroupDailyReport, request.getParameterMap());
+            }
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+
+        //Step.2 AutoPoi 导出Excel
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        List<EtlKuaiShouGroupDailyReport> pageList = etlKuaiShouGroupDailyReportService.list(queryWrapper);
+        //导出文件名称
+        mv.addObject(NormalExcelConstants.FILE_NAME, "快手组日报数据清洗列表");
+        mv.addObject(NormalExcelConstants.CLASS, EtlKuaiShouGroupDailyReport.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<EtlKuaiShouGroupDailyReport> listEtlKuaiShouGroupDailyReports = ExcelImportUtil.importExcel(file.getInputStream(), EtlKuaiShouGroupDailyReport.class, params);
+                etlKuaiShouGroupDailyReportService.saveBatch(listEtlKuaiShouGroupDailyReports);
+                return Result.ok("文件导入成功!数据行数:" + listEtlKuaiShouGroupDailyReports.size());
+            } catch (Exception e) {
+                log.error(e.getMessage(), e);
+                return Result.error("文件导入失败:" + e.getMessage());
+            } finally {
+                try {
+                    file.getInputStream().close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+        return Result.ok("文件导入失败!");
+    }
+
+}

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

@@ -0,0 +1,270 @@
+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.EtlKuaiShouNewly;
+import cn.com.ctop.kuaishou.modules.report.service.IEtlKuaiShouNewlyService;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import 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-03-08
+ */
+@Slf4j
+@Api(tags = "快手 新上计划数据汇总")
+@RestController
+@RequestMapping("/etl/kuaiShouNewly")
+public class EtlKuaiShouNewlyController {
+    @Autowired
+    private IEtlKuaiShouNewlyService etlKuaiShouNewlyService;
+
+    /**
+     * 分页列表查询
+     *
+     * @param etlKuaiShouNewly
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @AutoLog(value = "快手 新上计划数据汇总-分页列表查询")
+    @ApiOperation(value = "快手 新上计划数据汇总-分页列表查询", notes = "快手 新上计划数据汇总-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<IPage<EtlKuaiShouNewly>> queryPageList(EtlKuaiShouNewly etlKuaiShouNewly,
+                                                         @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                         @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                         HttpServletRequest req) {
+        Result<IPage<EtlKuaiShouNewly>> result = new Result<>();
+        QueryWrapper<EtlKuaiShouNewly> queryWrapper = QueryGenerator.initQueryWrapper(etlKuaiShouNewly, req.getParameterMap());
+        Page<EtlKuaiShouNewly> page = new Page<EtlKuaiShouNewly>(pageNo, pageSize);
+        IPage<EtlKuaiShouNewly> pageList = etlKuaiShouNewlyService.page(page, queryWrapper);
+        result.setSuccess(true);
+        result.setResult(pageList);
+        return result;
+    }
+
+    /**
+     * 各维度近七日上线数量
+     * @author ZHAOXA
+     * @param
+     * @return
+     * @throws
+     */
+    @AutoLog(value = "各维度近七日上线数量")
+    @ApiOperation(value = "各维度近七日上线数量", notes = "各维度近七日上线数量")
+    @GetMapping(value = "/getNewlyCounts")
+    public Result<Object> getNewlyCounts(Long accountId) {
+        try {
+            return etlKuaiShouNewlyService.getNewlyCounts(accountId);
+        } catch (Exception e) {
+            log.error("查询异常,", e.getMessage());
+            e.printStackTrace();
+        }
+        return Result.error("查询失败");
+    }
+
+    /**
+     * 添加
+     *
+     * @param etlKuaiShouNewly
+     * @return
+     */
+    @AutoLog(value = "快手 新上计划数据汇总-添加")
+    @ApiOperation(value = "快手 新上计划数据汇总-添加", notes = "快手 新上计划数据汇总-添加")
+    @PostMapping(value = "/add")
+    public Result<EtlKuaiShouNewly> add(@RequestBody EtlKuaiShouNewly etlKuaiShouNewly) {
+        Result<EtlKuaiShouNewly> result = new Result<>();
+        try {
+            etlKuaiShouNewlyService.save(etlKuaiShouNewly);
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+
+    /**
+     * 编辑
+     *
+     * @param etlKuaiShouNewly
+     * @return
+     */
+    @AutoLog(value = "快手 新上计划数据汇总-编辑")
+    @ApiOperation(value = "快手 新上计划数据汇总-编辑", notes = "快手 新上计划数据汇总-编辑")
+    @PutMapping(value = "/edit")
+    public Result<EtlKuaiShouNewly> edit(@RequestBody EtlKuaiShouNewly etlKuaiShouNewly) {
+        Result<EtlKuaiShouNewly> result = new Result<EtlKuaiShouNewly>();
+        EtlKuaiShouNewly etlKuaiShouNewlyEntity = etlKuaiShouNewlyService.getById(etlKuaiShouNewly.getId());
+        if (etlKuaiShouNewlyEntity == null) {
+            result.error500("未找到对应实体");
+        } else {
+            boolean ok = etlKuaiShouNewlyService.updateById(etlKuaiShouNewly);
+            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 {
+            etlKuaiShouNewlyService.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<EtlKuaiShouNewly> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
+        Result<EtlKuaiShouNewly> result = new Result<>();
+        if (ids == null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        } else {
+            this.etlKuaiShouNewlyService.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<EtlKuaiShouNewly> queryById(@RequestParam(name = "id", required = true) String id) {
+        Result<EtlKuaiShouNewly> result = new Result<>();
+        EtlKuaiShouNewly etlKuaiShouNewly = etlKuaiShouNewlyService.getById(id);
+        if (etlKuaiShouNewly == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(etlKuaiShouNewly);
+            result.setSuccess(true);
+        }
+        return result;
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param response
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+        // Step.1 组装查询条件
+        QueryWrapper<EtlKuaiShouNewly> queryWrapper = null;
+        try {
+            String paramsStr = request.getParameter("paramsStr");
+            if (oConvertUtils.isNotEmpty(paramsStr)) {
+                String deString = URLDecoder.decode(paramsStr, "UTF-8");
+                EtlKuaiShouNewly etlKuaiShouNewly = JSON.parseObject(deString, EtlKuaiShouNewly.class);
+                queryWrapper = QueryGenerator.initQueryWrapper(etlKuaiShouNewly, request.getParameterMap());
+            }
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+
+        //Step.2 AutoPoi 导出Excel
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        List<EtlKuaiShouNewly> pageList = etlKuaiShouNewlyService.list(queryWrapper);
+        //导出文件名称
+        mv.addObject(NormalExcelConstants.FILE_NAME, "快手 新上计划数据汇总列表");
+        mv.addObject(NormalExcelConstants.CLASS, EtlKuaiShouNewly.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<EtlKuaiShouNewly> listEtlKuaiShouNewlys = ExcelImportUtil.importExcel(file.getInputStream(), EtlKuaiShouNewly.class, params);
+                etlKuaiShouNewlyService.saveBatch(listEtlKuaiShouNewlys);
+                return Result.ok("文件导入成功!数据行数:" + listEtlKuaiShouNewlys.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("文件导入失败!");
+    }
+
+}

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

@@ -0,0 +1,334 @@
+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.EtlKuaishouAudienceAccountDaily;
+import cn.com.ctop.kuaishou.modules.report.service.IEtlKuaishouAudienceAccountDailyService;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import 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.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+import org.springframework.web.servlet.ModelAndView;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 人群分析报表——年龄、性别数据
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2021-03-09
+ */
+@Slf4j
+@Api(tags = "人群分析报表——年龄、性别数据")
+@RestController
+@RequestMapping("/etl/audienceAccountDaily")
+public class EtlKuaishouAudienceAccountDailyController {
+    @Autowired
+    private IEtlKuaishouAudienceAccountDailyService etlKuaishouAudienceAccountDailyService;
+
+    /**
+     * 分页列表查询
+     *
+     * @param etlKuaishouAudienceAccountDaily
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @AutoLog(value = "人群分析报表——年龄、性别数据-分页列表查询")
+    @ApiOperation(value = "人群分析报表——年龄、性别数据-分页列表查询", notes = "人群分析报表——年龄、性别数据-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<IPage<EtlKuaishouAudienceAccountDaily>> queryPageList(EtlKuaishouAudienceAccountDaily etlKuaishouAudienceAccountDaily,
+                                                                        @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                                        @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                                        HttpServletRequest req) {
+        Result<IPage<EtlKuaishouAudienceAccountDaily>> result = new Result<>();
+        QueryWrapper<EtlKuaishouAudienceAccountDaily> queryWrapper = QueryGenerator.initQueryWrapper(etlKuaishouAudienceAccountDaily, req.getParameterMap());
+        Page<EtlKuaishouAudienceAccountDaily> page = new Page<EtlKuaishouAudienceAccountDaily>(pageNo, pageSize);
+        IPage<EtlKuaishouAudienceAccountDaily> pageList = etlKuaishouAudienceAccountDailyService.page(page, queryWrapper);
+        result.setSuccess(true);
+        result.setResult(pageList);
+        return result;
+    }
+
+    /**
+     * 添加
+     *
+     * @param etlKuaishouAudienceAccountDaily
+     * @return
+     */
+    @AutoLog(value = "人群分析报表——年龄、性别数据-添加")
+    @ApiOperation(value = "人群分析报表——年龄、性别数据-添加", notes = "人群分析报表——年龄、性别数据-添加")
+    @PostMapping(value = "/add")
+    public Result<EtlKuaishouAudienceAccountDaily> add(@RequestBody EtlKuaishouAudienceAccountDaily etlKuaishouAudienceAccountDaily) {
+        Result<EtlKuaishouAudienceAccountDaily> result = new Result<>();
+        try {
+            etlKuaishouAudienceAccountDailyService.save(etlKuaishouAudienceAccountDaily);
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+
+    @GetMapping(value = "/createDate")
+    public Result<Object> createDate() {
+        try {
+            etlKuaishouAudienceAccountDailyService.queryEveryDayAudienceInfo();
+            return Result.ok("success");
+        } catch (Exception e) {
+            log.error("error:", e.getMessage());
+            e.printStackTrace();
+        }
+        return Result.error("error");
+    }
+
+
+    /**
+     * 按照年龄查询数据
+     *
+     * @param
+     * @return
+     * @throws
+     * @author ZHAOXA
+     */
+    @AutoLog(value = "按照年龄查询数据")
+    @ApiOperation(value = "按照年龄查询数据", notes = "按照年龄查询数据")
+    @PostMapping(value = "/getAgeInfo")
+    public Result<Object> getAgeInfo(@RequestBody JSONObject request) {
+        try {
+            return etlKuaishouAudienceAccountDailyService.getAgeInfo(request);
+        } catch (Exception e) {
+            log.error("查询异常,", e.getMessage());
+            e.printStackTrace();
+        }
+        return Result.error("查询失败");
+    }
+
+    /**
+     * 按照性别查询数据
+     *
+     * @param
+     * @return
+     * @throws
+     * @author ZHAOXA
+     */
+    @AutoLog(value = "按照性别查询数据")
+    @ApiOperation(value = "按照性别查询数据", notes = "按照性别查询数据")
+    @PostMapping(value = "/getSexInfo")
+    public Result<Object> getSexInfo(@RequestBody JSONObject request) {
+        try {
+            return etlKuaishouAudienceAccountDailyService.getSexInfo(request);
+        } catch (Exception e) {
+            log.error("查询异常,", e.getMessage());
+            e.printStackTrace();
+        }
+        return Result.error("查询失败");
+    }
+
+
+    /**
+     * 按照板位查询数据
+     *分版位
+     * @param
+     * @return
+     * @throws
+     * @author ZHAOXA
+     */
+    @AutoLog(value = "按照板位查询数据")
+    @ApiOperation(value = "按照板位查询数据", notes = "按照板位查询数据")
+    @PostMapping(value = "/getSceneInfo")
+    public Result<Object> getSceneInfo(@RequestBody JSONObject request) {
+        try {
+            return etlKuaishouAudienceAccountDailyService.getSceneInfo(request);
+        } catch (Exception e) {
+            log.error("查询异常,", e.getMessage());
+            e.printStackTrace();
+        }
+        return Result.error("查询失败");
+    }
+
+    /**
+     * 编辑
+     *
+     * @param etlKuaishouAudienceAccountDaily
+     * @return
+     */
+    @AutoLog(value = "人群分析报表——年龄、性别数据-编辑")
+    @ApiOperation(value = "人群分析报表——年龄、性别数据-编辑", notes = "人群分析报表——年龄、性别数据-编辑")
+    @PutMapping(value = "/edit")
+    public Result<EtlKuaishouAudienceAccountDaily> edit(@RequestBody EtlKuaishouAudienceAccountDaily etlKuaishouAudienceAccountDaily) {
+        Result<EtlKuaishouAudienceAccountDaily> result = new Result<EtlKuaishouAudienceAccountDaily>();
+        EtlKuaishouAudienceAccountDaily etlKuaishouAudienceAccountDailyEntity = etlKuaishouAudienceAccountDailyService.getById(etlKuaishouAudienceAccountDaily.getId());
+        if (etlKuaishouAudienceAccountDailyEntity == null) {
+            result.error500("未找到对应实体");
+        } else {
+            boolean ok = etlKuaishouAudienceAccountDailyService.updateById(etlKuaishouAudienceAccountDaily);
+            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 {
+            etlKuaishouAudienceAccountDailyService.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<EtlKuaishouAudienceAccountDaily> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
+        Result<EtlKuaishouAudienceAccountDaily> result = new Result<>();
+        if (ids == null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        } else {
+            this.etlKuaishouAudienceAccountDailyService.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<EtlKuaishouAudienceAccountDaily> queryById(@RequestParam(name = "id", required = true) String id) {
+        Result<EtlKuaishouAudienceAccountDaily> result = new Result<>();
+        EtlKuaishouAudienceAccountDaily etlKuaishouAudienceAccountDaily = etlKuaishouAudienceAccountDailyService.getById(id);
+        if (etlKuaishouAudienceAccountDaily == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(etlKuaishouAudienceAccountDaily);
+            result.setSuccess(true);
+        }
+        return result;
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param response
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+        // Step.1 组装查询条件
+        QueryWrapper<EtlKuaishouAudienceAccountDaily> queryWrapper = null;
+        try {
+            String paramsStr = request.getParameter("paramsStr");
+            if (oConvertUtils.isNotEmpty(paramsStr)) {
+                String deString = URLDecoder.decode(paramsStr, "UTF-8");
+                EtlKuaishouAudienceAccountDaily etlKuaishouAudienceAccountDaily = JSON.parseObject(deString, EtlKuaishouAudienceAccountDaily.class);
+                queryWrapper = QueryGenerator.initQueryWrapper(etlKuaishouAudienceAccountDaily, request.getParameterMap());
+            }
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+
+        //Step.2 AutoPoi 导出Excel
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        List<EtlKuaishouAudienceAccountDaily> pageList = etlKuaishouAudienceAccountDailyService.list(queryWrapper);
+        //导出文件名称
+        mv.addObject(NormalExcelConstants.FILE_NAME, "人群分析报表——年龄、性别数据列表");
+        mv.addObject(NormalExcelConstants.CLASS, EtlKuaishouAudienceAccountDaily.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<EtlKuaishouAudienceAccountDaily> listEtlKuaishouAudienceAccountDailys = ExcelImportUtil.importExcel(file.getInputStream(), EtlKuaishouAudienceAccountDaily.class, params);
+                etlKuaishouAudienceAccountDailyService.saveBatch(listEtlKuaishouAudienceAccountDailys);
+                return Result.ok("文件导入成功!数据行数:" + listEtlKuaishouAudienceAccountDailys.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("文件导入失败!");
+    }
+
+}

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

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

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

@@ -0,0 +1,354 @@
+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.EtlKuaishouReportAccountHourly;
+import cn.com.ctop.kuaishou.modules.report.service.IEtlKuaishouReportAccountHourlyService;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import 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.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+import org.springframework.web.servlet.ModelAndView;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 账户维度-每小时盯盘数据
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2021-03-04
+ */
+@Slf4j
+@Api(tags = "账户维度-每小时盯盘数据")
+@RestController
+@RequestMapping("/etl/reportAccountHourly")
+public class EtlKuaishouReportAccountHourlyController {
+    @Autowired
+    private IEtlKuaishouReportAccountHourlyService etlKuaishouReportAccountHourlyService;
+
+    /**
+     * 分页列表查询
+     *
+     * @param etlKuaishouReportAccountHourly
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @AutoLog(value = "账户维度-每小时盯盘数据-分页列表查询")
+    @ApiOperation(value = "账户维度-每小时盯盘数据-分页列表查询", notes = "账户维度-每小时盯盘数据-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<IPage<EtlKuaishouReportAccountHourly>> queryPageList(EtlKuaishouReportAccountHourly etlKuaishouReportAccountHourly,
+                                                                       @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                                       @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                                       HttpServletRequest req) {
+        Result<IPage<EtlKuaishouReportAccountHourly>> result = new Result<>();
+        QueryWrapper<EtlKuaishouReportAccountHourly> queryWrapper = QueryGenerator.initQueryWrapper(etlKuaishouReportAccountHourly, req.getParameterMap());
+        Page<EtlKuaishouReportAccountHourly> page = new Page<EtlKuaishouReportAccountHourly>(pageNo, pageSize);
+        IPage<EtlKuaishouReportAccountHourly> pageList = etlKuaishouReportAccountHourlyService.page(page, queryWrapper);
+        result.setSuccess(true);
+        result.setResult(pageList);
+        return result;
+    }
+
+    @GetMapping(value = "/createDate")
+    public Result<Object> createDate() {
+        try {
+            etlKuaishouReportAccountHourlyService.queryEveryhourlyDataForAccount();
+            return Result.ok("success");
+        } catch (Exception e) {
+            log.error("error:", e.getMessage());
+            e.printStackTrace();
+        }
+        return Result.error("error");
+    }
+
+
+    /**
+     * 获取当日花费最大的账户
+     *
+     * @param
+     * @return
+     * @throws
+     * @author ZHAOXA
+     */
+    @AutoLog(value = "获取当日花费最大的账户")
+    @ApiOperation(value = "获取当日花费最大的账户", notes = "获取当日花费最大的账户")
+    @GetMapping(value = "/getMaxChargeAccountIdByUser")
+    public Result<Object> getMaxChargeAccountIdByUser(String userId) {
+        try {
+            return etlKuaishouReportAccountHourlyService.getMaxChargeAccountIdByUser(userId);
+        } catch (Exception e) {
+            log.error("查询异常,", e.getMessage());
+            e.printStackTrace();
+        }
+        return Result.error("查询失败");
+    }
+
+    /**
+     * 获取当日花费最大的账户
+     *
+     * @param
+     * @return
+     * @throws
+     * @author ZHAOXA
+     */
+    @AutoLog(value = "获取当日花费最大的账户")
+    @ApiOperation(value = "获取当日花费最大的账户", notes = "获取当日花费最大的账户")
+    @GetMapping(value = "/getMaxChargeAccountId")
+    public Result<Object> getMaxChargeAccountId(Long accountId) {
+        try {
+            return etlKuaishouReportAccountHourlyService.getMaxChargeAccountId(accountId);
+        } catch (Exception e) {
+            log.error("查询异常,", e.getMessage());
+            e.printStackTrace();
+        }
+        return Result.error("查询失败");
+    }
+
+    /**
+     * 获取时间趋势汇总投放数据
+     *
+     * @param
+     * @return
+     * @throws
+     * @author ZHAOXA
+     */
+    @AutoLog(value = "获取时间趋势汇总投放数据")
+    @ApiOperation(value = "获取时间趋势汇总投放数据", notes = "获取时间趋势汇总投放数据")
+    @PostMapping(value = "/getAggregateByHour")
+    public Result<Object> getAggregateByHour(@RequestBody JSONObject request) {
+        try {
+            return etlKuaishouReportAccountHourlyService.getAggregateByHour(request);
+        } catch (Exception e) {
+            log.error("查询异常,", e.getMessage());
+            e.printStackTrace();
+        }
+        return Result.error("查询失败");
+    }
+
+    /**
+     * 获取时间趋势数据集
+     *
+     * @param
+     * @return
+     * @throws
+     * @author ZHAOXA
+     */
+    @AutoLog(value = "获取时间趋势数据集")
+    @ApiOperation(value = "获取时间趋势数据集", notes = "获取时间趋势数据集")
+    @PostMapping(value = "/getEtlReportList")
+    public Result<Object> getEtlReportList(@RequestBody JSONObject request) {
+        try {
+            return etlKuaishouReportAccountHourlyService.getEtlReportList(request);
+        } catch (Exception e) {
+            log.error("查询异常,", e.getMessage());
+            e.printStackTrace();
+        }
+        return Result.error("查询失败");
+    }
+
+    /**
+     * 添加
+     *
+     * @param etlKuaishouReportAccountHourly
+     * @return
+     */
+    @AutoLog(value = "账户维度-每小时盯盘数据-添加")
+    @ApiOperation(value = "账户维度-每小时盯盘数据-添加", notes = "账户维度-每小时盯盘数据-添加")
+    @PostMapping(value = "/add")
+    public Result<EtlKuaishouReportAccountHourly> add(@RequestBody EtlKuaishouReportAccountHourly etlKuaishouReportAccountHourly) {
+        Result<EtlKuaishouReportAccountHourly> result = new Result<>();
+        try {
+            etlKuaishouReportAccountHourlyService.save(etlKuaishouReportAccountHourly);
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+
+    /**
+     * 编辑
+     *
+     * @param etlKuaishouReportAccountHourly
+     * @return
+     */
+    @AutoLog(value = "账户维度-每小时盯盘数据-编辑")
+    @ApiOperation(value = "账户维度-每小时盯盘数据-编辑", notes = "账户维度-每小时盯盘数据-编辑")
+    @PutMapping(value = "/edit")
+    public Result<EtlKuaishouReportAccountHourly> edit(@RequestBody EtlKuaishouReportAccountHourly etlKuaishouReportAccountHourly) {
+        Result<EtlKuaishouReportAccountHourly> result = new Result<EtlKuaishouReportAccountHourly>();
+        EtlKuaishouReportAccountHourly etlKuaishouReportAccountHourlyEntity = etlKuaishouReportAccountHourlyService.getById(etlKuaishouReportAccountHourly.getId());
+        if (etlKuaishouReportAccountHourlyEntity == null) {
+            result.error500("未找到对应实体");
+        } else {
+            boolean ok = etlKuaishouReportAccountHourlyService.updateById(etlKuaishouReportAccountHourly);
+            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 {
+            etlKuaishouReportAccountHourlyService.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<EtlKuaishouReportAccountHourly> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
+        Result<EtlKuaishouReportAccountHourly> result = new Result<>();
+        if (ids == null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        } else {
+            this.etlKuaishouReportAccountHourlyService.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<EtlKuaishouReportAccountHourly> queryById(@RequestParam(name = "id", required = true) String id) {
+        Result<EtlKuaishouReportAccountHourly> result = new Result<>();
+        EtlKuaishouReportAccountHourly etlKuaishouReportAccountHourly = etlKuaishouReportAccountHourlyService.getById(id);
+        if (etlKuaishouReportAccountHourly == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(etlKuaishouReportAccountHourly);
+            result.setSuccess(true);
+        }
+        return result;
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param response
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+        // Step.1 组装查询条件
+        QueryWrapper<EtlKuaishouReportAccountHourly> queryWrapper = null;
+        try {
+            String paramsStr = request.getParameter("paramsStr");
+            if (oConvertUtils.isNotEmpty(paramsStr)) {
+                String deString = URLDecoder.decode(paramsStr, "UTF-8");
+                EtlKuaishouReportAccountHourly etlKuaishouReportAccountHourly = JSON.parseObject(deString, EtlKuaishouReportAccountHourly.class);
+                queryWrapper = QueryGenerator.initQueryWrapper(etlKuaishouReportAccountHourly, request.getParameterMap());
+            }
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+
+        //Step.2 AutoPoi 导出Excel
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        List<EtlKuaishouReportAccountHourly> pageList = etlKuaishouReportAccountHourlyService.list(queryWrapper);
+        //导出文件名称
+        mv.addObject(NormalExcelConstants.FILE_NAME, "账户维度-每小时盯盘数据列表");
+        mv.addObject(NormalExcelConstants.CLASS, EtlKuaishouReportAccountHourly.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<EtlKuaishouReportAccountHourly> listEtlKuaishouReportAccountHourlys = ExcelImportUtil.importExcel(file.getInputStream(), EtlKuaishouReportAccountHourly.class, params);
+                etlKuaishouReportAccountHourlyService.saveBatch(listEtlKuaishouReportAccountHourlys);
+                return Result.ok("文件导入成功!数据行数:" + listEtlKuaishouReportAccountHourlys.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("文件导入失败!");
+    }
+
+}

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

@@ -0,0 +1,91 @@
+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-03-10
+ */
+@Data
+@TableName("ctop_etl_kuaishou_account_material_overview")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_etl_kuaishou_account_material_overview对象", description = "清洗数据账户素材概览数据")
+public class EtlKuaiShouAccountMaterialOverview {
+
+    /**
+     * id
+     */
+    @TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "id")
+    private Long id;
+    /**
+     * 账户id
+     */
+    @Excel(name = "账户id", width = 15)
+    @ApiModelProperty(value = "账户id")
+    private Long accountId;
+    /**
+     * 新上素材数
+     */
+    @Excel(name = "新上素材数", width = 15)
+    @ApiModelProperty(value = "新上素材数")
+    private Integer newlyCount;
+    /**
+     * 新上素材素材使用数
+     */
+    @Excel(name = "新上素材素材使用数", width = 15)
+    @ApiModelProperty(value = "新上素材素材使用数")
+    private Integer newlyUseCount;
+    /**
+     * 总素材数
+     */
+    @Excel(name = "总素材数", width = 15)
+    @ApiModelProperty(value = "总素材数")
+    private Integer totalCount;
+    /**
+     * 有效素材数
+     */
+    @Excel(name = "有效素材数", width = 15)
+    @ApiModelProperty(value = "有效素材数")
+    private Integer effectiveCount;
+    /**
+     * 爆款素材数
+     */
+    @Excel(name = "爆款素材数", width = 15)
+    @ApiModelProperty(value = "爆款素材数")
+    private Integer hotMoneyCount;
+    /**
+     * 日期
+     */
+    @Excel(name = "日期", width = 15, format = "yyyy-MM-dd")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
+    @ApiModelProperty(value = "日期")
+    private Date stateDate;
+    /**
+     * createTime
+     */
+    @ApiModelProperty(value = "createTime")
+    private Date createTime;
+    /**
+     * updateTime
+     */
+    @ApiModelProperty(value = "updateTime")
+    private Date updateTime;
+}

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

@@ -0,0 +1,181 @@
+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-03-09
+ */
+@Data
+@TableName("ctop_etl_kuaishou_group_daily_report")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_etl_kuaishou_group_daily_report对象", description = "快手组日报数据清洗")
+public class EtlKuaiShouGroupDailyReport {
+
+    /**
+     * 主键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 campaignId;
+    /**
+     * 计划名称
+     */
+    @Excel(name = "计划名称", width = 15)
+    @ApiModelProperty(value = "计划名称")
+    private String campaignName;
+    /**
+     * 组id
+     */
+    @Excel(name = "组id", width = 15)
+    @ApiModelProperty(value = "组id")
+    private Long unitId;
+    /**
+     * 组名称
+     */
+    @Excel(name = "组名称", width = 15)
+    @ApiModelProperty(value = "组名称")
+    private String unitName;
+    /**
+     * 花费(元)
+     */
+    @Excel(name = "花费(元)", width = 15)
+    @ApiModelProperty(value = "花费(元)")
+    private java.math.BigDecimal charge;
+    /**
+     * 出价
+     */
+    @Excel(name = "出价", width = 15)
+    @ApiModelProperty(value = "出价")
+    private Long bid;
+    private Integer bidType;
+    private Integer unitStatus;
+    /**
+     * 曝光数
+     */
+    @Excel(name = "曝光数", width = 15)
+    @ApiModelProperty(value = "曝光数")
+    private Long photoShow;
+    /**
+     * 素材曝光数
+     */
+    @Excel(name = "素材曝光数", width = 15)
+    @ApiModelProperty(value = "素材曝光数")
+    private Long aclick;
+    /**
+     * 行为数
+     */
+    @Excel(name = "行为数", width = 15)
+    @ApiModelProperty(value = "行为数")
+    private Long bclick;
+    /**
+     * 应用下载数据-安卓下载开始数
+     */
+    @Excel(name = "应用下载数据-安卓下载开始数", width = 15)
+    @ApiModelProperty(value = "应用下载数据-安卓下载开始数")
+    private Long downloadStarted;
+    /**
+     * 应用下载数据-安卓下载完成数
+     */
+    @Excel(name = "应用下载数据-安卓下载完成数", width = 15)
+    @ApiModelProperty(value = "应用下载数据-安卓下载完成数")
+    private Long downloadCompleted;
+    /**
+     * 应用下载数据-激活数
+     */
+    @Excel(name = "应用下载数据-激活数", width = 15)
+    @ApiModelProperty(value = "应用下载数据-激活数")
+    private Long activation;
+    /**
+     * 应用下载数据-首日付费次数
+     */
+    @Excel(name = "应用下载数据-首日付费次数", width = 15)
+    @ApiModelProperty(value = "应用下载数据-首日付费次数")
+    private Long eventPayFirstDay;
+    /**
+     * 应用下载数据-付费次数
+     */
+    @Excel(name = "应用下载数据-付费次数", width = 15)
+    @ApiModelProperty(value = "应用下载数据-付费次数")
+    private Long eventPay;
+    /**
+     * 应用下载数据-注册数
+     */
+    @Excel(name = "应用下载数据-注册数", width = 15)
+    @ApiModelProperty(value = "应用下载数据-注册数")
+    private Long eventRegister;
+    /**
+     * 应用下载数据-完件数
+     */
+    @Excel(name = "应用下载数据-完件数", width = 15)
+    @ApiModelProperty(value = "应用下载数据-完件数")
+    private Long eventJinJianApp;
+    /**
+     * 应用下载数据-付款成功数
+     */
+    @Excel(name = "应用下载数据-付款成功数", width = 15)
+    @ApiModelProperty(value = "应用下载数据-付款成功数")
+    private Long eventOrderPaid;
+    /**
+     * 应用下载数据-次留数(仅支持分日查询)
+     */
+    @Excel(name = "应用下载数据-次留数(仅支持分日查询)", width = 15)
+    @ApiModelProperty(value = "应用下载数据-次留数(仅支持分日查询)")
+    private Long eventNextDayStay;
+    /**
+     * 3s播放数
+     */
+    @Excel(name = "3s播放数", width = 15)
+    @ApiModelProperty(value = "3s播放数")
+    private Long play3sCount;
+    /**
+     * 时间
+     */
+    @Excel(name = "时间", width = 15)
+    @ApiModelProperty(value = "时间")
+    private String statDate;
+    /**
+     * 创建时间
+     */
+    @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;
+}

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

@@ -0,0 +1,108 @@
+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-03-08
+ */
+@Data
+@TableName("ctop_etl_kuaishou_newly")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_etl_kuaishou_newly对象", description = "快手 新上计划数据汇总")
+public class EtlKuaiShouNewly {
+
+    /**
+     * 主键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;
+    /**
+     * 账户id
+     */
+    @Excel(name = "账户id", width = 15)
+    @ApiModelProperty(value = "账户id")
+    private Long accountId;
+    /**
+     * 账户授权名称
+     */
+    @Excel(name = "账户授权名称", width = 15)
+    @ApiModelProperty(value = "账户授权名称")
+    private String oauthName;
+    /**
+     * 绑定人id
+     */
+    @Excel(name = "绑定人id", width = 15)
+    @ApiModelProperty(value = "绑定人id")
+    private String userId;
+    /**
+     * 绑定人名称
+     */
+    @Excel(name = "绑定人名称", width = 15)
+    @ApiModelProperty(value = "绑定人名称")
+    private String userName;
+    /**
+     * 新上数量
+     */
+    @Excel(name = "新上数量", width = 15)
+    @ApiModelProperty(value = "新上数量")
+    private Integer newCount;
+    /**
+     * campaign:计划  unit:组 creative:创意
+     */
+    @Excel(name = "campaign:计划  unit:组 creative:创意", width = 15)
+    @ApiModelProperty(value = "campaign:计划  unit:组 creative:创意")
+    private String newType;
+    /**
+     * 时间
+     */
+    @Excel(name = "时间", width = 15)
+    @ApiModelProperty(value = "时间")
+    private String statDate;
+    /**
+     * 创建时间
+     */
+    @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;
+}

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

@@ -0,0 +1,139 @@
+package cn.com.ctop.kuaishou.modules.report.entity;
+
+import java.io.Serializable;
+import java.util.Date;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.TableField;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.springframework.format.annotation.DateTimeFormat;
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+/**
+ * 人群分析报表——年龄、性别数据
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2021-03-09
+ */
+@Data
+@TableName("ctop_etl_kuaishou_audience_account_daily")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_etl_kuaishou_audience_account_daily对象", description = "人群分析报表——年龄、性别数据")
+public class EtlKuaishouAudienceAccountDaily {
+
+    /**
+     * id
+     */
+    @TableId(type = IdType.INPUT)
+    @ApiModelProperty(value = "id")
+    private Long id;
+    /**
+     * 日期
+     */
+    @Excel(name = "日期", width = 15)
+    @ApiModelProperty(value = "日期")
+    private String statDate;
+    /**
+     * 账户ID
+     */
+    @Excel(name = "账户ID", width = 15)
+    @ApiModelProperty(value = "账户ID")
+    private Long accountId;
+    /**
+     * province: 省级地域分布,city: 地级地域分布,gender: 性别分布,ageSegment: 年龄分布,clientId: 系统分布,businessInterestTags: 商业兴趣分布
+     */
+    @Excel(name = "province: 省级地域分布,city: 地级地域分布,gender: 性别分布,ageSegment: 年龄分布,clientId: 系统分布,businessInterestTags: 商业兴趣分布", width = 15)
+    @ApiModelProperty(value = "province: 省级地域分布,city: 地级地域分布,gender: 性别分布,ageSegment: 年龄分布,clientId: 系统分布,businessInterestTags: 商业兴趣分布")
+    private String audienceType;
+    /**
+     * 花费
+     */
+    @Excel(name = "花费", width = 15)
+    @ApiModelProperty(value = "花费")
+    private Double charge;
+    /**
+     * 应用下载数据-激活数
+     */
+    @Excel(name = "应用下载数据-激活数", width = 15)
+    @ApiModelProperty(value = "应用下载数据-激活数")
+    private Long activation;
+    /**
+     * 应用下载数据-付费次数
+     */
+    @Excel(name = "应用下载数据-付费次数", width = 15)
+    @ApiModelProperty(value = "应用下载数据-付费次数")
+    private Long eventPay;
+    /**
+     * 应用下载数据-付费金额
+     */
+    @Excel(name = "应用下载数据-付费金额", width = 15)
+    @ApiModelProperty(value = "应用下载数据-付费金额")
+    private java.math.BigDecimal eventPayPurchaseAmount;
+    /**
+     * 应用下载数据-次留数(仅支持分日查询)
+     */
+    @Excel(name = "应用下载数据-次留数(仅支持分日查询)", width = 15)
+    @ApiModelProperty(value = "应用下载数据-次留数(仅支持分日查询)")
+    private Long eventNextDayStay;
+    /**
+     * 素材曝光数
+     */
+    @Excel(name = "素材曝光数", width = 15)
+    @ApiModelProperty(value = "素材曝光数")
+    private Long aclick;
+    /**
+     * 行为数
+     */
+    @Excel(name = "行为数", width = 15)
+    @ApiModelProperty(value = "行为数")
+    private Long bclick;
+    /**
+     * 封面点击数
+     */
+    @Excel(name = "封面点击数", width = 15)
+    @ApiModelProperty(value = "封面点击数")
+    private Long photoClick;
+    /**
+     * 封面曝光数
+     */
+    @Excel(name = "封面曝光数", width = 15)
+    @ApiModelProperty(value = "封面曝光数")
+    private Long photoShow;
+    /**
+     * 性别
+     */
+    @Excel(name = "性别", width = 15)
+    @ApiModelProperty(value = "性别")
+    private String gender;
+    /**
+     * 年龄
+     */
+    @Excel(name = "年龄", width = 15)
+    @ApiModelProperty(value = "年龄")
+    private String ageSegment;
+    /**
+     * 创建时间
+     */
+    @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;
+}

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

@@ -0,0 +1,253 @@
+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;
+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.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * 账户维度-每日盯盘数据
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2021-03-04
+ */
+@Data
+@TableName("ctop_etl_kuaishou_report_account_daily")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_etl_kuaishou_report_account_daily对象", description = "账户维度-每日盯盘数据")
+public class EtlKuaishouReportAccountDaily {
+
+    /**
+     * id
+     */
+    @TableId(type = IdType.INPUT)
+    @ApiModelProperty(value = "id")
+    private Long id;
+    /**
+     * 日期
+     */
+    @Excel(name = "日期", width = 15)
+    @ApiModelProperty(value = "日期")
+    private String statDate;
+    /**
+     * 账户ID
+     */
+    @Excel(name = "账户ID", width = 15)
+    @ApiModelProperty(value = "账户ID")
+    private Long accountId;
+    /**
+     * 花费(元)
+     */
+    @Excel(name = "花费(元)", width = 15)
+    @ApiModelProperty(value = "花费(元)")
+    private BigDecimal charge;
+    /**
+     * 封面曝光数
+     */
+    @Excel(name = "封面曝光数", width = 15)
+    @ApiModelProperty(value = "封面曝光数")
+    private Long photoShow;
+    /**
+     * 封面点击数
+     */
+    @Excel(name = "封面点击数", width = 15)
+    @ApiModelProperty(value = "封面点击数")
+    private Long photoClick;
+    /**
+     * 素材曝光数
+     */
+    @Excel(name = "素材曝光数", width = 15)
+    @ApiModelProperty(value = "素材曝光数")
+    private Long aclick;
+    /**
+     * 行为数
+     */
+    @Excel(name = "行为数", width = 15)
+    @ApiModelProperty(value = "行为数")
+    private Long bclick;
+    /**
+     * 分享数
+     */
+    @Excel(name = "分享数", width = 15)
+    @ApiModelProperty(value = "分享数")
+    private Long photoShare;
+    /**
+     * 评论数
+     */
+    @Excel(name = "评论数", width = 15)
+    @ApiModelProperty(value = "评论数")
+    private Long photoComment;
+    /**
+     * 点赞数
+     */
+    @Excel(name = "点赞数", width = 15)
+    @ApiModelProperty(value = "点赞数")
+    private Long photoLike;
+    /**
+     * 新增关注数
+     */
+    @Excel(name = "新增关注数", width = 15)
+    @ApiModelProperty(value = "新增关注数")
+    private Long follow;
+    /**
+     * 取消关注数
+     */
+    @Excel(name = "取消关注数", width = 15)
+    @ApiModelProperty(value = "取消关注数")
+    private Long cancelFollow;
+    /**
+     * 举报数
+     */
+    @Excel(name = "举报数", width = 15)
+    @ApiModelProperty(value = "举报数")
+    private Long report;
+    /**
+     * 拉黑数
+     */
+    @Excel(name = "拉黑数", width = 15)
+    @ApiModelProperty(value = "拉黑数")
+    private Long block;
+    /**
+     * 减少此类作品数
+     */
+    @Excel(name = "减少此类作品数", width = 15)
+    @ApiModelProperty(value = "减少此类作品数")
+    private Long negative;
+    /**
+     * 应用下载数据-安卓下载开始数
+     */
+    @Excel(name = "应用下载数据-安卓下载开始数", width = 15)
+    @ApiModelProperty(value = "应用下载数据-安卓下载开始数")
+    private Long downloadStarted;
+    /**
+     * 应用下载数据-安卓下载完成数
+     */
+    @Excel(name = "应用下载数据-安卓下载完成数", width = 15)
+    @ApiModelProperty(value = "应用下载数据-安卓下载完成数")
+    private Long downloadCompleted;
+    /**
+     * 应用下载数据-激活数
+     */
+    @Excel(name = "应用下载数据-激活数", width = 15)
+    @ApiModelProperty(value = "应用下载数据-激活数")
+    private Long activation;
+    /**
+     * 提交按钮点击数
+     */
+    @Excel(name = "提交按钮点击数", width = 15)
+    @ApiModelProperty(value = "提交按钮点击数")
+    private Long submit;
+    /**
+     * 应用下载数据-首日付费次数
+     */
+    @Excel(name = "应用下载数据-首日付费次数", width = 15)
+    @ApiModelProperty(value = "应用下载数据-首日付费次数")
+    private Long eventPayFirstDay;
+    /**
+     * 应用下载数据-首日付费金额
+     */
+    @Excel(name = "应用下载数据-首日付费金额", width = 15)
+    @ApiModelProperty(value = "应用下载数据-首日付费金额")
+    private BigDecimal eventPayPurchaseAmountFirstDay;
+    /**
+     * 应用下载数据-付费次数
+     */
+    @Excel(name = "应用下载数据-付费次数", width = 15)
+    @ApiModelProperty(value = "应用下载数据-付费次数")
+    private Long eventPay;
+    /**
+     * 应用下载数据-付费金额
+     */
+    @Excel(name = "应用下载数据-付费金额", width = 15)
+    @ApiModelProperty(value = "应用下载数据-付费金额")
+    private BigDecimal eventPayPurchaseAmount;
+    /**
+     * 应用下载数据-注册数
+     */
+    @Excel(name = "应用下载数据-注册数", width = 15)
+    @ApiModelProperty(value = "应用下载数据-注册数")
+    private Long eventRegister;
+    /**
+     * 应用下载数据-完件数
+     */
+    @Excel(name = "应用下载数据-完件数", width = 15)
+    @ApiModelProperty(value = "应用下载数据-完件数")
+    private Long eventJinJianApp;
+    /**
+     * 应用下载数据-授信数
+     */
+    @Excel(name = "应用下载数据-授信数", width = 15)
+    @ApiModelProperty(value = "应用下载数据-授信数")
+    private Long eventCreditGrantApp;
+    /**
+     * 应用下载数据-付款成功数
+     */
+    @Excel(name = "应用下载数据-付款成功数", width = 15)
+    @ApiModelProperty(value = "应用下载数据-付款成功数")
+    private Long eventOrderPaid;
+    /**
+     * 应用下载数据-付款成功金额
+     */
+    @Excel(name = "应用下载数据-付款成功金额", width = 15)
+    @ApiModelProperty(value = "应用下载数据-付款成功金额")
+    private BigDecimal eventOrderPaidPurchaseAmount;
+    /**
+     * 落地页数据-落地页完件数
+     */
+    @Excel(name = "落地页数据-落地页完件数", width = 15)
+    @ApiModelProperty(value = "落地页数据-落地页完件数")
+    private Long eventJinJianLandingPage;
+    /**
+     * 落地页数据-落地页授信数
+     */
+    @Excel(name = "落地页数据-落地页授信数", width = 15)
+    @ApiModelProperty(value = "落地页数据-落地页授信数")
+    private Long eventCreditGrantLandingPage;
+    /**
+     * 应用下载数据-次留数(仅支持分日查询)
+     */
+    @Excel(name = "应用下载数据-次留数(仅支持分日查询)", width = 15)
+    @ApiModelProperty(value = "应用下载数据-次留数(仅支持分日查询)")
+    private Long eventNextDayStay;
+    /**
+     * 落地页数据-表单提交数
+     */
+    @Excel(name = "落地页数据-表单提交数", width = 15)
+    @ApiModelProperty(value = "落地页数据-表单提交数")
+    private Long formCount;
+    /**
+     * 3s播放数
+     */
+    @Excel(name = "3s播放数", width = 15)
+    @ApiModelProperty(value = "3s播放数")
+    private long play3sCount;
+    /**
+     * 创建时间
+     */
+    @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;
+}

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

@@ -0,0 +1,322 @@
+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.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.TableField;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.springframework.format.annotation.DateTimeFormat;
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+/**
+ * 账户维度-每小时盯盘数据
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2021-03-04
+ */
+@Data
+@TableName("ctop_etl_kuaishou_report_account_hourly")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_etl_kuaishou_report_account_hourly对象", description = "账户维度-每小时盯盘数据")
+public class EtlKuaishouReportAccountHourly {
+
+    /**
+     * id
+     */
+    @TableId(type = IdType.INPUT)
+    @ApiModelProperty(value = "id")
+    private Long id;
+    /**
+     * 日期
+     */
+    @Excel(name = "日期", width = 15)
+    @ApiModelProperty(value = "日期")
+    private String statDate;
+    /**
+     * 时间
+     */
+    @Excel(name = "时间", width = 15)
+    @ApiModelProperty(value = "时间")
+    private Long statHour;
+    /**
+     * 账户ID
+     */
+    @Excel(name = "账户ID", width = 15)
+    @ApiModelProperty(value = "账户ID")
+    private Long accountId;
+    /**
+     * 花费(元)
+     */
+    @Excel(name = "花费(元)", width = 15)
+    @ApiModelProperty(value = "花费(元)")
+    private BigDecimal charge;
+    /**
+     * 封面曝光数
+     */
+    @Excel(name = "封面曝光数", width = 15)
+    @ApiModelProperty(value = "封面曝光数")
+    private Long photoShow;
+    /**
+     * 封面点击数
+     */
+    @Excel(name = "封面点击数", width = 15)
+    @ApiModelProperty(value = "封面点击数")
+    private Long photoClick;
+    /**
+     * 素材曝光数
+     */
+    @Excel(name = "素材曝光数", width = 15)
+    @ApiModelProperty(value = "素材曝光数")
+    private Long aclick;
+    /**
+     * 行为数
+     */
+    @Excel(name = "行为数", width = 15)
+    @ApiModelProperty(value = "行为数")
+    private Long bclick;
+    /**
+     * 分享数
+     */
+    @Excel(name = "分享数", width = 15)
+    @ApiModelProperty(value = "分享数")
+    private Long photoShare;
+    /**
+     * 评论数
+     */
+    @Excel(name = "评论数", width = 15)
+    @ApiModelProperty(value = "评论数")
+    private Long photoComment;
+    /**
+     * 点赞数
+     */
+    @Excel(name = "点赞数", width = 15)
+    @ApiModelProperty(value = "点赞数")
+    private Long photoLike;
+    /**
+     * 新增关注数
+     */
+    @Excel(name = "新增关注数", width = 15)
+    @ApiModelProperty(value = "新增关注数")
+    private Long follow;
+    /**
+     * 取消关注数
+     */
+    @Excel(name = "取消关注数", width = 15)
+    @ApiModelProperty(value = "取消关注数")
+    private Long cancelFollow;
+    /**
+     * 举报数
+     */
+    @Excel(name = "举报数", width = 15)
+    @ApiModelProperty(value = "举报数")
+    private Long report;
+    /**
+     * 拉黑数
+     */
+    @Excel(name = "拉黑数", width = 15)
+    @ApiModelProperty(value = "拉黑数")
+    private Long block;
+    /**
+     * 减少此类作品数
+     */
+    @Excel(name = "减少此类作品数", width = 15)
+    @ApiModelProperty(value = "减少此类作品数")
+    private Long negative;
+    /**
+     * 应用下载数据-安卓下载开始数
+     */
+    @Excel(name = "应用下载数据-安卓下载开始数", width = 15)
+    @ApiModelProperty(value = "应用下载数据-安卓下载开始数")
+    private Long downloadStarted;
+    /**
+     * 应用下载数据-安卓下载完成数
+     */
+    @Excel(name = "应用下载数据-安卓下载完成数", width = 15)
+    @ApiModelProperty(value = "应用下载数据-安卓下载完成数")
+    private Long downloadCompleted;
+    /**
+     * 应用下载数据-激活数
+     */
+    @Excel(name = "应用下载数据-激活数", width = 15)
+    @ApiModelProperty(value = "应用下载数据-激活数")
+    private Long activation;
+    /**
+     * 提交按钮点击数
+     */
+    @Excel(name = "提交按钮点击数", width = 15)
+    @ApiModelProperty(value = "提交按钮点击数")
+    private Long submit;
+    /**
+     * 应用下载数据-首日付费次数
+     */
+    @Excel(name = "应用下载数据-首日付费次数", width = 15)
+    @ApiModelProperty(value = "应用下载数据-首日付费次数")
+    private Long eventPayFirstDay;
+    /**
+     * 应用下载数据-首日付费金额
+     */
+    @Excel(name = "应用下载数据-首日付费金额", width = 15)
+    @ApiModelProperty(value = "应用下载数据-首日付费金额")
+    private BigDecimal eventPayPurchaseAmountFirstDay;
+    /**
+     * 应用下载数据-付费次数
+     */
+    @Excel(name = "应用下载数据-付费次数", width = 15)
+    @ApiModelProperty(value = "应用下载数据-付费次数")
+    private Long eventPay;
+    /**
+     * 应用下载数据-付费金额
+     */
+    @Excel(name = "应用下载数据-付费金额", width = 15)
+    @ApiModelProperty(value = "应用下载数据-付费金额")
+    private BigDecimal eventPayPurchaseAmount;
+    /**
+     * 应用下载数据-注册数
+     */
+    @Excel(name = "应用下载数据-注册数", width = 15)
+    @ApiModelProperty(value = "应用下载数据-注册数")
+    private Long eventRegister;
+    /**
+     * 应用下载数据-完件数
+     */
+    @Excel(name = "应用下载数据-完件数", width = 15)
+    @ApiModelProperty(value = "应用下载数据-完件数")
+    private Long eventJinJianApp;
+    /**
+     * 应用下载数据-授信数
+     */
+    @Excel(name = "应用下载数据-授信数", width = 15)
+    @ApiModelProperty(value = "应用下载数据-授信数")
+    private Long eventCreditGrantApp;
+    /**
+     * 应用下载数据-付款成功数
+     */
+    @Excel(name = "应用下载数据-付款成功数", width = 15)
+    @ApiModelProperty(value = "应用下载数据-付款成功数")
+    private Long eventOrderPaid;
+    /**
+     * 应用下载数据-付款成功金额
+     */
+    @Excel(name = "应用下载数据-付款成功金额", width = 15)
+    @ApiModelProperty(value = "应用下载数据-付款成功金额")
+    private BigDecimal eventOrderPaidPurchaseAmount;
+    /**
+     * 落地页数据-落地页完件数
+     */
+    @Excel(name = "落地页数据-落地页完件数", width = 15)
+    @ApiModelProperty(value = "落地页数据-落地页完件数")
+    private Long eventJinJianLandingPage;
+    /**
+     * 落地页数据-落地页授信数
+     */
+    @Excel(name = "落地页数据-落地页授信数", width = 15)
+    @ApiModelProperty(value = "落地页数据-落地页授信数")
+    private Long eventCreditGrantLandingPage;
+    /**Save pv the next day
+     * 应用下载数据-次留数(仅支持分日查询)
+     */
+    @Excel(name = "应用下载数据-次留数(仅支持分日查询)", width = 15)
+    @ApiModelProperty(value = "应用下载数据-次留数(仅支持分日查询)")
+    private Long eventNextDayStay;
+    /**
+     * 落地页数据-表单提交数
+     */
+    @Excel(name = "落地页数据-表单提交数", width = 15)
+    @ApiModelProperty(value = "落地页数据-表单提交数")
+    private Long formCount;
+    /**
+     * 3s播放数
+     */
+    @Excel(name = "3s播放数", width = 15)
+    @ApiModelProperty(value = "3s播放数")
+    private long play3sCount;
+    /**
+     * 创建时间
+     */
+    @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;
+
+    @TableField(exist = false)
+    private BigDecimal activationCost;//激活单价
+    @TableField(exist = false)
+    private BigDecimal impression1kCost;//平均千次素材曝光花费 = 花费/素材曝光数*1000
+    @TableField(exist = false)
+    private BigDecimal photoClickCost;//平均封面点击单价 = 花费/封面点击数
+    @TableField(exist = false)
+    private BigDecimal actionCost;//平均行为单价 = 总花费/行为数
+    @TableField(exist = false)
+    private BigDecimal play3sRatio;//3S播放率 = 广告视频播放3s数量/封面曝光数
+    @TableField(exist = false)
+    private BigDecimal downloadStartedCost;//安卓下载开始单价(元) =花费/安卓下载开始数
+    @TableField(exist = false)
+    private BigDecimal downloadCompletedCost;//安卓下载完成单价(元) =花费/安卓下载完成数
+    @TableField(exist = false)
+    private BigDecimal formCost;//表单提交单价 =当日消耗/当日回传表单数
+    @TableField(exist = false)
+    private BigDecimal eventPayFirstDayCost;//首日付费次数成本 =消耗/首日付费次数
+    @TableField(exist = false)
+    private BigDecimal eventPayCost;//付费次数成本 =消耗/付费次数
+    @TableField(exist = false)
+    private BigDecimal eventRegisterCost;//注册成本 =当日消耗/当日回传注册数
+    @TableField(exist = false)
+    private BigDecimal eventNextDayStayCost;//次日留存成本 =消耗/次日留存PV
+    @TableField(exist = false)
+    private BigDecimal eventJinJianAppCost;//完件成本 =消耗/完件数
+    @TableField(exist = false)
+    private BigDecimal eventCreditGrantAppCost;//授信成本 =消耗/授信数
+    @TableField(exist = false)
+    private BigDecimal eventJinJianLandingPageCost;//落地页完件成本 =当日消耗/当日回传完件数
+    @TableField(exist = false)
+    private BigDecimal eventCreditGrantLandingPageCost;//落地页授信成本 =当日消耗/当日回传授信数
+    @TableField(exist = false)
+    private BigDecimal submitCost;//按钮点击成本 =当日消耗 / 当日按钮点击数
+    @TableField(exist = false)
+    private BigDecimal eventPayFirstDayRoi;//首日ROI =首日付费金额/当日消耗
+    @TableField(exist = false)
+    private BigDecimal eventPayRoi;//ROI =付费金额/当日消耗
+    @TableField(exist = false)
+    private BigDecimal actionRatio;//行为率 =行为数占素材曝光数百分比
+    @TableField(exist = false)
+    private BigDecimal photoClickRatio;//封面点击率 =封面点击数占封面曝光数百分比
+    @TableField(exist = false)
+    private BigDecimal downloadStartedRatio;//安卓下载开始率 =安卓下载开始数/行为数
+    @TableField(exist = false)
+    private BigDecimal downloadCompletedRatio;//安卓下载完成率 =安卓下载完成数/安卓下载开始数
+    @TableField(exist = false)
+    private BigDecimal activationRatio;//下载完成激活率 =激活数/安卓下载完成数
+    @TableField(exist = false)
+    private BigDecimal clickOnActivationRatio;//下载完成激活率 =激活数/安卓下载完成数
+    @TableField(exist = false)
+    private BigDecimal eventRegisterRatio;//注册率 =当日回传注册数/当日激活数
+    @TableField(exist = false)
+    private BigDecimal eventNextDayStayRatio;//次日留存率 =次留数/前一日激活数
+    @TableField(exist = false)
+    private BigDecimal eventCreditGrantAppRatio;//授信率 =当日回传授信数/当日回传的完件数
+    @TableField(exist = false)
+    private BigDecimal formActionRatio;//表单提交点击率 =当日回传表单数/当日行为数
+    @TableField(exist = false)
+    private BigDecimal submitRatio;//按钮点击率 =当日按钮点击数 / 当日行为数
+    private BigDecimal grew=new BigDecimal(0);//同比 = (今日实时花费-昨日截止到此时的花费)/昨日截止到此时的花费*100%;
+}

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

@@ -21,6 +21,9 @@ public class KuaishouReportDailyAccount implements Serializable {
     @JsonProperty("charge")
     private BigDecimal charge;
 
+    @JsonProperty("ad_scene")
+    private String adScene;
+
     @JsonProperty("photo_show")
     private Long photoShow;
 

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

@@ -1,5 +1,6 @@
 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;
@@ -14,9 +15,8 @@ import java.util.Date;
 @TableName("ctop_kuaishou_report_hourly_account")
 public class KuaishouReportHourlyAccount implements Serializable {
     private static final long serialVersionUID = 1L;
-    @TableId
+    @TableId(type = IdType.UUID)
     private String id;
-
     private Long accountId;
     @JsonProperty("stat_date")
     private String statDate;
@@ -35,22 +35,7 @@ public class KuaishouReportHourlyAccount implements Serializable {
     private Long aclick;
     @JsonProperty
     private Long bclick;
-    @JsonProperty
-    private Long share;
-    @JsonProperty
-    private Long comment;
-    @JsonProperty
-    private Long photoLike;
-    @JsonProperty
-    private Long follow;
-    @JsonProperty("cancel_follow")
-    private Long cancelFollow;
-    @JsonProperty
-    private Long report;
-    @JsonProperty
-    private Long block;
-    @JsonProperty
-    private Long negative;
+
     @JsonProperty("download_started")
     private Long downloadStarted;
     @JsonProperty("download_completed")
@@ -119,6 +104,27 @@ public class KuaishouReportHourlyAccount implements Serializable {
     private BigDecimal eventCreditGrantLandingPageCost;
     @JsonProperty
     private BigDecimal eventNextDayStay;
+    @JsonProperty("play_3s_ratio")
+    @TableField("play_3s_ratio")
+    private BigDecimal play3sRatio;
+
+    @JsonProperty
+    private Long share;
+    @JsonProperty
+    private Long comment;
+    @JsonProperty
+    private Long photoLike;
+    @JsonProperty
+    private Long follow;
+    @JsonProperty("cancel_follow")
+    private Long cancelFollow;
+    @JsonProperty
+    private Long report;
+    @JsonProperty
+    private Long block;
+    @JsonProperty
+    private Long negative;
+
     @JsonProperty
     private Date createTime;
     @JsonProperty

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

@@ -0,0 +1,80 @@
+package cn.com.ctop.kuaishou.modules.report.enums;
+
+public enum CheckParametersEnum {
+    PARAMETER1("charge", "charge"),
+    PARAMETER2("photoShow", "photo_show"),
+    PARAMETER3("photoClick", "photo_click"),
+    PARAMETER4("aclick", "aclick"),
+    PARAMETER5("bclick", "bclick"),
+    PARAMETER6("photoShare", "photo_share"),
+    PARAMETER7("photoComment", "photo_comment"),
+    PARAMETER8("photoLike", "photo_like"),
+    PARAMETER9("follow", "follow"),
+    PARAMETER10("cancelFollow", "cancel_follow"),
+    PARAMETER11("report", "report"),
+    PARAMETER12("block", "block"),
+    PARAMETER13("negative", "negative"),
+    PARAMETER14("downloadStarted", "download_started"),
+    PARAMETER15("downloadCompleted", "download_completed"),
+    PARAMETER16("activation", "activation"),
+    PARAMETER17("submit", "submit"),
+    PARAMETER18("eventPayFirstDay", "event_pay_first_day"),
+    PARAMETER19("eventPayPurchaseAmountFirstDay", "event_pay_purchase_amount_first_day"),
+    PARAMETER20("eventPay", "event_pay"),
+    PARAMETER21("eventPayPurchaseAmount", "event_pay_purchase_amount"),
+    PARAMETER22("eventRegister", "event_register"),
+    PARAMETER23("eventJinJianApp", "event_jin_jian_app"),
+    PARAMETER24("eventCreditGrantApp", "event_credit_grant_app"),
+    PARAMETER25("eventOrderPaid", "event_order_paid"),
+    PARAMETER26("eventOrderPaidPurchaseAmount", "event_order_paid_purchase_amount"),
+    PARAMETER27("eventJinJianLandingPage", "event_jin_jian_landing_page"),
+    PARAMETER28("eventCreditGrantLandingPage", "event_credit_grant_landing_page"),
+    PARAMETER29("eventNextDayStay", "event_next_day_stay"),
+    PARAMETER31("play3sRatio", "play_3s_ratio"),
+    PARAMETER32("play3sCount", "play_3s_count"),
+    PARAMETER30("formCount", "form_count");
+
+    private String sqlName;
+    private String value;
+
+    CheckParametersEnum(String value, String sqlName) {
+        this.value = value;
+        this.sqlName = sqlName;
+    }
+
+    public static String getSqlName(String value) {
+        for (CheckParametersEnum campaignType : CheckParametersEnum.values()) {
+            if (campaignType.getValue().equals(value)) {
+                return campaignType.getSqlName();
+            }
+        }
+        return "";
+    }
+
+    public static boolean isInclude(String key) {
+        boolean include = false;
+        for (CheckParametersEnum e : CheckParametersEnum.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 getSqlName() {
+        return sqlName;
+    }
+
+    public void setSqlName(String sqlName) {
+        this.sqlName = sqlName;
+    }
+}

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

@@ -0,0 +1,19 @@
+package cn.com.ctop.kuaishou.modules.report.mapper;
+
+import cn.com.ctop.kuaishou.modules.report.entity.EtlKuaiShouAccountMaterialOverview;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 清洗数据账户素材概览数据
+ *
+ * @author: jeecg-boot
+ * @date: 2021-03-10
+ * @cersion: V1.0
+ */
+public interface EtlKuaiShouAccountMaterialOverviewMapper extends BaseMapper<EtlKuaiShouAccountMaterialOverview> {
+
+    void replaceInsert(EtlKuaiShouAccountMaterialOverview etlKuaiShouAccountMaterialOverview);
+
+    JSONObject getMaterialOverview(Long accountId, String statDate);
+}

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

@@ -0,0 +1,26 @@
+package cn.com.ctop.kuaishou.modules.report.mapper;
+
+import cn.com.ctop.kuaishou.modules.report.entity.EtlKuaiShouGroupDailyReport;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 快手组日报数据清洗
+ *
+ * @author: jeecg-boot
+ * @date: 2021-03-09
+ * @cersion: V1.0
+ */
+public interface EtlKuaiShouGroupDailyReportMapper extends BaseMapper<EtlKuaiShouGroupDailyReport> {
+
+    void replaceBatch(@Param("addList") List<EtlKuaiShouGroupDailyReport> addList);
+
+    Long getTotal(Long accountId);
+
+    List<JSONObject> queryPageList(@Param("accountId") Long accountId, @Param("sortCode") String sortCode, @Param("sortType") String sortType);
+
+    void updateStatus(@Param("accountId")  Long accountId,@Param("unitId")  Long unitId, @Param("putStatus") Integer putStatus);
+}

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

@@ -0,0 +1,22 @@
+package cn.com.ctop.kuaishou.modules.report.mapper;
+
+import cn.com.ctop.kuaishou.modules.report.entity.EtlKuaiShouNewly;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+
+/**
+ * 快手 新上计划数据汇总
+ *
+ * @author: jeecg-boot
+ * @date: 2021-03-08
+ * @cersion: V1.0
+ */
+public interface EtlKuaiShouNewlyMapper extends BaseMapper<EtlKuaiShouNewly> {
+
+    void replaceBatch(@Param("addList") List<EtlKuaiShouNewly> addList);
+
+    List<Object> getNewlyCounts(@Param("accountId") Long accountId);
+}

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

@@ -0,0 +1,32 @@
+package cn.com.ctop.kuaishou.modules.report.mapper;
+
+import cn.com.ctop.kuaishou.modules.report.entity.EtlKuaishouAudienceAccountDaily;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 人群分析报表——年龄、性别数据
+ *
+ * @author: jeecg-boot
+ * @date: 2021-03-09
+ * @cersion: V1.0
+ */
+public interface EtlKuaishouAudienceAccountDailyMapper extends BaseMapper<EtlKuaishouAudienceAccountDaily> {
+
+    void replaceBatch(@Param("list") List<EtlKuaishouAudienceAccountDaily> list);
+
+    List<JSONObject> queryAudienceTypeInfo(@Param("value") String value, @Param("type") String type, @Param("accountId") Long accountId, @Param("audienceType") String audienceType, @Param("parType") String parType);
+
+    List<JSONObject> queryEveryDayInfo(@Param("value") String value, @Param("type") String type, @Param("accountId") Long accountId, @Param("audienceType") String audienceType, @Param("parType") String parType,@Param("day") String day);
+
+    List<JSONObject> getSceneInfo(@Param("value") String value, @Param("accountId") Long accountId, @Param("parType") String parType);
+
+    List<JSONObject> getSceneEveryDayInfo(@Param("value") String value, @Param("accountId") Long accountId, @Param("parType") String parType,@Param("day") String day);
+
+    List<String> getTypeList(@Param("type") String type,@Param("audienceType") String audienceType);
+
+    List<String> getSceneTypeList();
+}

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

@@ -0,0 +1,29 @@
+package cn.com.ctop.kuaishou.modules.report.mapper;
+
+import java.util.List;
+
+import cn.com.ctop.kuaishou.modules.report.entity.EtlKuaishouReportAccountHourly;
+import com.alibaba.fastjson.JSONObject;
+import org.apache.ibatis.annotations.Param;
+import cn.com.ctop.kuaishou.modules.report.entity.EtlKuaishouReportAccountDaily;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 盯盘日数据
+ *
+ * @author: jeecg-boot
+ * @date: 2021-03-04
+ * @cersion: V1.0
+ */
+public interface EtlKuaishouReportAccountDailyMapper extends BaseMapper<EtlKuaishouReportAccountDaily> {
+
+    void replaceBatch(@Param("list") List<EtlKuaishouReportAccountDaily> list);
+
+    EtlKuaishouReportAccountHourly getOnedayAggregatebyDaily(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("accountId") Long accountId);
+
+    List<JSONObject> getOnedayEtlReportList(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("accountId") Long accountId, @Param("value") String value, @Param("type") String type);
+
+    JSONObject getMaxChargeAccountId(@Param("userId") String userId);
+
+    String getNewlyUpdateTime();
+}

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

@@ -0,0 +1,28 @@
+package cn.com.ctop.kuaishou.modules.report.mapper;
+
+
+import java.util.List;
+
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouAppList;
+import cn.com.ctop.kuaishou.modules.report.entity.EtlKuaishouReportAccountHourly;
+import com.alibaba.fastjson.JSONObject;
+import org.apache.ibatis.annotations.Param;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 账户维度-每小时盯盘数据
+ *
+ * @author: jeecg-boot
+ * @date: 2021-03-04
+ * @cersion: V1.0
+ */
+public interface EtlKuaishouReportAccountHourlyMapper extends BaseMapper<EtlKuaishouReportAccountHourly> {
+
+    void replaceBatch(@Param("list") List<EtlKuaishouReportAccountHourly> list);
+
+    EtlKuaishouReportAccountHourly getOnedayAggregateByHour(@Param("startTime") String startTime, @Param("accountId") Long accountId);
+
+    List<JSONObject> getOnedayEtlReportList(@Param("startTime") String startTime, @Param("accountId") Long accountId,@Param("value") String value,@Param("type") String type);
+
+    String getNewlyUpdateTime();
+}

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

@@ -1,5 +1,6 @@
 package cn.com.ctop.kuaishou.modules.report.mapper;
 
+import cn.com.ctop.kuaishou.modules.report.entity.EtlKuaishouAudienceAccountDaily;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaishouAudienceReportDailyAccount;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
@@ -22,4 +23,6 @@ public interface KuaishouAudienceReportDailyAccountMapper extends BaseMapper<Kua
     List<String> querybusinessTypeCount(KuaishouAudienceReportDailyAccount audienceReport);
 
     List<JSONObject> querybusinessTypeReportForm(KuaishouAudienceReportDailyAccount audienceReport);
+
+    List<EtlKuaishouAudienceAccountDaily> queryEveryDayAudienceInfo();
 }

+ 25 - 19
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaishouReportDailyAccountMapper.java

@@ -1,14 +1,12 @@
 package cn.com.ctop.kuaishou.modules.report.mapper;
 
 import cn.com.ctop.common.module.vo.KuaishouReportAccountDailyDTOEntity;
-import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAccount;
-import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAccountDTO;
-import cn.com.ctop.kuaishou.modules.report.entity.KuaishouVideoInfoDTO;
-import cn.com.ctop.kuaishou.modules.report.entity.ProjectAccountDTO;
+import cn.com.ctop.kuaishou.modules.report.entity.*;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Param;
 
+import java.math.BigDecimal;
 import java.util.List;
 
 public interface KuaishouReportDailyAccountMapper extends BaseMapper<KuaishouReportDailyAccount> {
@@ -19,33 +17,41 @@ public interface KuaishouReportDailyAccountMapper extends BaseMapper<KuaishouRep
 
     List<JSONObject> selectCost(@Param("accountId") Long accountId, @Param("startDate") String startDate, @Param("endDate") String endDate);
 
-    List<ProjectAccountDTO> getKuaishouProjectInfo(@Param("startDate")String startDate, @Param("endDate")String endDate, @Param("projectList")List<Long> projectList, @Param("yn")Integer yn);
+    List<ProjectAccountDTO> getKuaishouProjectInfo(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("projectList") List<Long> projectList, @Param("yn") Integer yn);
 
-    List<KuaishouReportDailyAccountDTO> getKuaishouAccountInfoByProjectId(@Param("projectId")Long projectId, @Param("startDate")String startDate, @Param("endDate")String endDate, @Param("projectList")List<Long> projectList, @Param("accountIds")List<Long> accountIds, @Param("yn")Integer yn);
+    List<KuaishouReportDailyAccountDTO> getKuaishouAccountInfoByProjectId(@Param("projectId") Long projectId, @Param("startDate") String startDate, @Param("endDate") String endDate, @Param("projectList") List<Long> projectList, @Param("accountIds") List<Long> accountIds, @Param("yn") Integer yn);
 
-    List<KuaishouReportDailyAccountDTO> getKuaishouCampaignInfoByAccountId(@Param("projectList")List<Long> projectList, @Param("startDate")String startDate, @Param("endDate")String endDate, @Param("accountId")Long accountId, @Param("accountIds")List<Long> accountIds, @Param("yn")Integer yn);
+    List<KuaishouReportDailyAccountDTO> getKuaishouCampaignInfoByAccountId(@Param("projectList") List<Long> projectList, @Param("startDate") String startDate, @Param("endDate") String endDate, @Param("accountId") Long accountId, @Param("accountIds") List<Long> accountIds, @Param("yn") Integer yn);
 
-    List<KuaishouReportDailyAccountDTO> getKuaishouUnitInfoByCampaignId(@Param("projectList")List<Long> projectList, @Param("startDate")String startDate, @Param("endDate")String endDate, @Param("campaignId")Long campaignId, @Param("accountIds")List<Long> accountIds, @Param("yn")Integer yn);
+    List<KuaishouReportDailyAccountDTO> getKuaishouUnitInfoByCampaignId(@Param("projectList") List<Long> projectList, @Param("startDate") String startDate, @Param("endDate") String endDate, @Param("campaignId") Long campaignId, @Param("accountIds") List<Long> accountIds, @Param("yn") Integer yn);
 
-    List<Long> queryProjectMemberByUserId(@Param("userId")String userId, @Param("mediaIds")List<Long> mediaIds);
+    List<Long> queryProjectMemberByUserId(@Param("userId") String userId, @Param("mediaIds") List<Long> mediaIds);
 
-    List<Long> queryProjectInfoBySaleId(@Param("userId")String userId, @Param("mediaIds")List<Long> mediaIds);
+    List<Long> queryProjectInfoBySaleId(@Param("userId") String userId, @Param("mediaIds") List<Long> mediaIds);
 
-    List<ProjectAccountDTO> queryProjectMemberByIds(@Param("projectIds")List<Long> projectIds);
+    List<ProjectAccountDTO> queryProjectMemberByIds(@Param("projectIds") List<Long> projectIds);
 
-    String getRoleCodeByUserId(@Param("userId")String userId);
+    String getRoleCodeByUserId(@Param("userId") String userId);
 
-    List<Long> queryProjectMemberByAdmins(@Param("mediaIds")List<Long> mediaIds);
+    List<Long> queryProjectMemberByAdmins(@Param("mediaIds") List<Long> mediaIds);
 
-    List<KuaishouReportDailyAccountDTO> getKuaishouCreativeInfoByUnitId(@Param("projectList")List<Long> projectList, @Param("startDate")String startDate, @Param("endDate")String endDate, @Param("unitId")Long unitId, @Param("accountIds") List<Long> accoundIds, @Param("yn")Integer yn);
+    List<KuaishouReportDailyAccountDTO> getKuaishouCreativeInfoByUnitId(@Param("projectList") List<Long> projectList, @Param("startDate") String startDate, @Param("endDate") String endDate, @Param("unitId") Long unitId, @Param("accountIds") List<Long> accoundIds, @Param("yn") Integer yn);
 
-    KuaishouVideoInfoDTO getVideoUrl(@Param("photoId")Long photoId);
+    KuaishouVideoInfoDTO getVideoUrl(@Param("photoId") Long photoId);
 
-    List<Long> getUserProjectAccountIds(@Param("userId")String userId, @Param("yn")Integer yn);
+    List<Long> getUserProjectAccountIds(@Param("userId") String userId, @Param("yn") Integer yn);
 
-    List<Long> getUserProjectAccountIdsByAdmin(@Param("yn")Integer yn);
+    List<Long> getUserProjectAccountIdsByAdmin(@Param("yn") Integer yn);
 
-    List<Long> getSaleProjectAccountIds(@Param("userId")String userId, @Param("yn")Integer yn);
+    List<Long> getSaleProjectAccountIds(@Param("userId") String userId, @Param("yn") Integer yn);
 
-    List<KuaishouReportAccountDailyDTOEntity> getKuaishouProjectInfoEntity(@Param("startDate")String startDate, @Param("endDate")String endDate, @Param("projectList")List<Long> projectList, @Param("yn")Integer yn);
+    List<KuaishouReportAccountDailyDTOEntity> getKuaishouProjectInfoEntity(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("projectList") List<Long> projectList, @Param("yn") Integer yn);
+
+    void replaceBatch(@Param("addList") List<KuaishouReportDailyAccount> addList);
+
+    void replaceBatchAdScene(@Param("addList") List<KuaishouReportDailyAccount> addList);
+
+    List<EtlKuaishouReportAccountDaily> queryEveryDayDataForAccount();
+
+    BigDecimal getSumChargeByAccountIdAndStatDate(@Param("accountId") Long accountId, @Param("statDate") String statDate);
 }

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

@@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Update;
 
+import java.util.List;
+
 public interface KuaishouReportDailyGroupMapper extends BaseMapper<KuaishouReportDailyGroup> {
     void loadGroupDailyReport(@Param("accountId") Long accountId, @Param("localPath") String localPath);
 
@@ -14,4 +16,6 @@ public interface KuaishouReportDailyGroupMapper extends BaseMapper<KuaishouRepor
     void formatChannelCode(@Param("date") String date);
 
     int insertSelective(KuaishouReportDailyGroup record);
+
+    void replaceBatch(@Param("addList") List<KuaishouReportDailyGroup> addList);
 }

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

@@ -1,13 +1,19 @@
 package cn.com.ctop.kuaishou.modules.report.mapper;
 
+import cn.com.ctop.kuaishou.modules.report.entity.EtlKuaishouReportAccountHourly;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportHourlyAccount;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Param;
 
 import java.math.BigDecimal;
+import java.util.List;
 
 public interface KuaishouReportHourlyAccountMapper extends BaseMapper<KuaishouReportHourlyAccount> {
     Integer selectMaxHour(@Param("accountId") Long accountId, @Param("statDate") String statDate);
 
     BigDecimal getCost(@Param("accountId") Long accountId, @Param("statHour") Integer statHour, @Param("statDate") String statDate);
+
+    void replaceBatch(@Param("addList") List<KuaishouReportHourlyAccount> addList);
+
+    List<EtlKuaishouReportAccountHourly> queryEveryhourlyDataForAccount();
 }

+ 10 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaishouVideoEtlInfoMapper.java

@@ -1,15 +1,24 @@
 package cn.com.ctop.kuaishou.modules.report.mapper;
 
 import cn.com.ctop.kuaishou.modules.report.entity.KuaishouVideoEtlInfo;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 /**
  * 快手视频信息清洗表(有效,爆款)
+ *
  * @author: jeecg-boot
- * @date:   2020-12-17
+ * @date: 2020-12-17
  * @cersion: V1.0
  */
 public interface KuaishouVideoEtlInfoMapper extends BaseMapper<KuaishouVideoEtlInfo> {
 
     String getCompanyNameByUserId(String planId);
+
+    Long getTotal(@Param("accountId") Long accountId, @Param("startTime") String startTime, @Param("endTime") String endTime);
+
+    List<JSONObject> queryPageList(@Param("accountId") Long accountId, @Param("sortCode") String sortCode, @Param("sortType") String sortType, @Param("startTime") String startTime, @Param("endTime") String endTime);
 }

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

@@ -0,0 +1,74 @@
+<?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.report.mapper.EtlKuaiShouAccountMaterialOverviewMapper">
+
+    <insert id="replaceInsert"
+            parameterType="cn.com.ctop.kuaishou.modules.report.entity.EtlKuaiShouAccountMaterialOverview">
+        replace into ctop_etl_kuaishou_account_material_overview
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="id != null">
+                id,
+            </if>
+            <if test="accountId != null">
+                account_id,
+            </if>
+            <if test="newlyCount != null">
+                newly_count,
+            </if>
+            <if test="newlyUseCount != null">
+                newly_use_count,
+            </if>
+            <if test="totalCount != null">
+                total_count,
+            </if>
+            <if test="effectiveCount != null">
+                effective_count,
+            </if>
+            <if test="hotMoneyCount != null">
+                hot_money_count,
+            </if>
+            <if test="stateDate != null">
+                state_date
+            </if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="id != null">
+                #{id},
+            </if>
+            <if test="accountId != null">
+                #{accountId},
+            </if>
+            <if test="newlyCount != null">
+                #{newlyCount},
+            </if>
+            <if test="newlyUseCount != null">
+                #{newlyUseCount},
+            </if>
+            <if test="totalCount != null">
+                #{totalCount},
+            </if>
+            <if test="effectiveCount != null">
+                #{effectiveCount},
+            </if>
+            <if test="hotMoneyCount != null">
+                #{hotMoneyCount},
+            </if>
+            <if test="stateDate != null">
+                #{stateDate}
+            </if>
+        </trim>
+    </insert>
+    <select id="getMaterialOverview" resultType="com.alibaba.fastjson.JSONObject">
+        select
+        newly_count as newlyCount,
+        newly_use_count as newlyUseCount,
+        total_count as totalCount,
+        effective_count as effectiveCount,
+        hot_money_count as hotMoneyCount,
+        update_time as updateTime
+        from  ctop_etl_kuaishou_account_material_overview
+        where account_id = #{accountId}
+        and state_date = #{statDate}
+
+    </select>
+</mapper>

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

@@ -0,0 +1,116 @@
+<?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.report.mapper.EtlKuaiShouGroupDailyReportMapper">
+
+    <insert id="replaceBatch">
+        replace into ctop_etl_kuaishou_group_daily_report(
+        account_id,
+        campaign_id,
+        campaign_name,
+        unit_id,
+        unit_name,
+        unit_status,
+        bid_type,
+        bid,
+        charge,
+        photo_show,
+        aclick,
+        bclick,
+        download_started,
+        download_completed,
+        activation,
+        event_pay_first_day,
+        event_pay,
+        event_register,
+        event_jin_jian_app,
+        event_order_paid,
+        event_next_day_stay,
+        play_3s_count,
+        stat_date
+        )
+        values
+        <foreach collection="addList" item="addList" separator=",">
+            (
+            #{addList.accountId},
+            #{addList.campaignId},
+            #{addList.campaignName},
+            #{addList.unitId},
+            #{addList.unitName},
+            #{addList.unitStatus},
+            #{addList.bidType},
+            #{addList.bid},
+            #{addList.charge},
+            #{addList.photoShow},
+            #{addList.aclick},
+            #{addList.bclick},
+            #{addList.downloadStarted},
+            #{addList.downloadCompleted},
+            #{addList.activation},
+            #{addList.eventPayFirstDay},
+            #{addList.eventPay},
+            #{addList.eventRegister},
+            #{addList.eventJinJianApp},
+            #{addList.eventOrderPaid},
+            #{addList.eventNextDayStay},
+            #{addList.play3sCount},
+            #{addList.statDate}
+            )
+        </foreach>
+    </insert>
+
+    <select id="getTotal" resultType="java.lang.Long">
+        SELECT count(1)
+        FROM ctop_etl_kuaishou_group_daily_report t1
+        WHERE account_id = #{accountId}
+          AND t1.charge > 0
+          AND stat_date = DATE_FORMAT(now(), '%Y-%m-%d')
+    </select>
+
+    <select id="queryPageList" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        t1.unit_id as 'unitId',
+        account_id as 'accountId',
+        unit_name as 'unitName',
+        t1.charge,
+        IFNULL(ROUND(t1.charge/activation,2),0) as 'activationCost',
+        bid,
+        bid_type as 'bidType',
+        unit_status as 'unitStatus',
+        activation,
+        IFNULL(ROUND((t1.charge-t2.charge)/t2.charge*100,2),0)'grew',
+        t1.update_time as 'updateTime'
+        FROM ctop_etl_kuaishou_group_daily_report t1
+        LEFT JOIN (
+        SELECT charge,unit_id FROM ctop_etl_kuaishou_group_daily_report
+        WHERE account_id = #{accountId}
+        AND stat_date = DATE_FORMAT(date_sub(now(), interval 1 day), '%Y-%m-%d')
+        ) t2 ON t1.unit_id = t2.unit_id
+        WHERE account_id = #{accountId}
+        AND t1.charge > 0
+        AND stat_date = DATE_FORMAT(now(), '%Y-%m-%d')
+        <if test="sortCode == 'charge' ">
+            ORDER BY t1.charge
+        </if>
+        <if test="sortCode == 'activationCost' ">
+
+            ORDER BY t1.charge/activation
+        </if>
+        <if test="sortCode == 'bid' ">
+            ORDER BY bid
+        </if>
+        <if test="sortCode == 'activation' ">
+            ORDER BY activation
+        </if>
+        ${sortType}
+    </select>
+
+    <update id="updateStatus">
+        update
+            ctop_etl_kuaishou_group_daily_report
+        set unit_status = #{putStatus}
+        where account_id = #{accountId}
+          and unit_id = #{unitId}
+          and stat_date = DATE_FORMAT(now(), '%Y-%m-%d')
+    </update>
+
+</mapper>

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

@@ -0,0 +1,43 @@
+<?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.report.mapper.EtlKuaiShouNewlyMapper">
+
+    <insert id="replaceBatch">
+        replace into ctop_etl_kuaishou_newly(
+        project_id,
+        project_name,
+        account_id,
+        oauth_name,
+        user_id,
+        user_name,
+        new_count,
+        new_type,
+        stat_date
+        )
+        values
+        <foreach collection="addList" item="addList" separator=",">
+            (
+            #{addList.projectId},
+            #{addList.projectName},
+            #{addList.accountId},
+            #{addList.oauthName},
+            #{addList.userId},
+            #{addList.userName},
+            #{addList.newCount},
+            #{addList.newType},
+            #{addList.statDate}
+            )
+        </foreach>
+    </insert>
+
+    <select id="getNewlyCounts" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT stat_date as 'statDate', account_id as 'accountId', new_count as 'newCount', new_type as 'newType'
+        FROM ctop_etl_kuaishou_newly
+        WHERE stat_date &gt;= DATE_FORMAT(date_sub(now(), interval 7 day), '%Y-%m-%d')
+          AND stat_date &lt;= DATE_FORMAT(date_sub(now(), interval 1 day), '%Y-%m-%d')
+          AND account_id = #{accountId}
+        group by stat_date, new_type
+    </select>
+
+
+</mapper>

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

@@ -0,0 +1,174 @@
+<?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.report.mapper.EtlKuaishouAudienceAccountDailyMapper">
+    <insert id="replaceBatch">
+        replace into ctop_etl_kuaishou_audience_account_daily(
+        stat_date,
+        account_id,
+        audience_type,
+        charge,
+        activation,
+        event_pay,
+        event_pay_purchase_amount,
+        event_next_day_stay,
+        aclick,
+        bclick,
+        photo_click,
+        photo_show,
+        gender,
+        age_segment
+        )
+        values
+        <foreach collection="list" item="appInfo" separator=",">
+            (
+            #{appInfo.statDate},
+            #{appInfo.accountId},
+            #{appInfo.audienceType},
+            #{appInfo.charge},
+            #{appInfo.activation},
+            #{appInfo.eventPay},
+            #{appInfo.eventPayPurchaseAmount},
+            #{appInfo.eventNextDayStay},
+            #{appInfo.aclick},
+            #{appInfo.bclick},
+            #{appInfo.photoClick},
+            #{appInfo.photoShow},
+            #{appInfo.gender},
+            #{appInfo.ageSegment}
+            )
+        </foreach>
+    </insert>
+
+    <select id="queryAudienceTypeInfo" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        account_id as 'accountId',
+        <if test="parType == 'alone'">
+            SUM(${value}) as 'value',
+        </if>
+        <if test="parType == 'more'">
+            <if test="value == 'activationCost'">
+                IFNULL(ROUND( SUM(charge)/ SUM(activation),2),0) as 'value',
+            </if>
+            <if test="value == 'eventPayRoi'">
+                IFNULL(ROUND( SUM(event_pay_purchase_amount)/ SUM(charge)*100,2),0) as 'value',
+            </if>
+            <if test="value == 'eventPayCost'">
+                IFNULL(ROUND( SUM(charge)/ SUM(event_pay),2),0) as 'value',
+            </if>
+            <if test="value == 'eventNextDayStayCost'">
+                IFNULL(ROUND(SUM(charge)/SUM(event_next_day_stay),2),0) as 'value',
+            </if>
+        </if>
+        ${type} as 'type'
+        FROM ctop_etl_kuaishou_audience_account_daily
+        where stat_date &gt;= DATE_FORMAT(date_sub(now(), interval 8 day), '%Y-%m-%d')
+        AND stat_date &lt;= DATE_FORMAT(date_sub(now(), interval 2 day), '%Y-%m-%d')
+        AND audience_type = #{audienceType}
+        AND account_id = #{accountId}
+        group by ${type}
+        ORDER BY ${type}
+    </select>
+
+    <select id="queryEveryDayInfo" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        account_id as 'accountId',
+        stat_date as 'statDate',
+        <if test="parType == 'alone'">
+            ${value} as 'value',
+        </if>
+        <if test="parType == 'more'">
+            <if test="value == 'activationCost'">
+                IFNULL(ROUND( charge/ activation,2),0) as 'value',
+            </if>
+            <if test="value == 'eventPayRoi'">
+                IFNULL(ROUND(event_pay_purchase_amount/charge*100,2),0) as 'value',
+            </if>
+            <if test="value == 'eventPayCost'">
+                IFNULL(ROUND(charge / event_pay,2),0) as 'value',
+            </if>
+            <if test="value == 'eventNextDayStayCost'">
+                IFNULL(ROUND(charge/ event_next_day_stay,2),0) as 'value',
+            </if>
+        </if>
+        ${type} as 'type'
+        FROM ctop_etl_kuaishou_audience_account_daily
+        where stat_date = #{day}
+        AND audience_type = #{audienceType}
+        AND account_id = #{accountId}
+        group by stat_date,${type}
+        order by stat_date,${type}
+    </select>
+
+    <select id="getSceneEveryDayInfo" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        account_id as 'accountId',
+        stat_date as 'statDate',
+        <if test="parType == 'alone'">
+            ${value} as 'value',
+        </if>
+        <if test="parType == 'more'">
+            <if test="value == 'activationCost'">
+                IFNULL(ROUND( charge/ activation,2),0) as 'value',
+            </if>
+            <if test="value == 'eventPayRoi'">
+                IFNULL(ROUND(event_pay_purchase_amount/charge*100,2),0) as 'value',
+            </if>
+            <if test="value == 'eventPayCost'">
+                IFNULL(ROUND(charge / event_pay,2),0) as 'value',
+            </if>
+            <if test="value == 'eventNextDayStayCost'">
+                IFNULL(ROUND(charge/ event_next_day_stay,2),0) as 'value',
+            </if>
+        </if>
+        IFNULL(ad_scene,'全部') as 'type'
+        FROM ctop_kuaishou_report_daily_account_ad_scene
+        where stat_date = #{day}
+        AND account_id = #{accountId}
+        group by stat_date,ad_scene
+        order by stat_date,ad_scene
+    </select>
+
+    <select id="getSceneTypeList" resultType="java.lang.String">
+        SELECT DISTINCT IFNULL(ad_scene, '全部')
+        FROM ctop_kuaishou_report_daily_account_ad_scene
+        WHERE LENGTH(trim(ad_scene))>0
+        ORDER BY ad_scene
+    </select>
+
+    <select id="getTypeList" resultType="java.lang.String">
+        SELECT ${type} as 'type'
+        FROM ctop_etl_kuaishou_audience_account_daily
+        where audience_type = #{audienceType}
+        group by ${type}
+        order by ${type}
+    </select>
+
+    <select id="getSceneInfo" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        account_id as 'accountId',
+        <if test="parType == 'alone'">
+            SUM(${value}) as 'value',
+        </if>
+        <if test="parType == 'more'">
+            <if test="value == 'activationCost'">
+                IFNULL(ROUND( SUM(charge)/ SUM(activation),2),0) as 'value',
+            </if>
+            <if test="value == 'eventPayRoi'">
+                IFNULL(ROUND( SUM(event_pay_purchase_amount)/ SUM(charge)*100,2),0) as 'value',
+            </if>
+            <if test="value == 'eventPayCost'">
+                IFNULL(ROUND( SUM(charge)/ SUM(event_pay),2),0) as 'value',
+            </if>
+            <if test="value == 'eventNextDayStayCost'">
+                IFNULL(ROUND(SUM(charge)/SUM(event_next_day_stay),2),0) as 'value',
+            </if>
+        </if>
+        IFNULL(ad_scene,'全部')as 'type'
+        FROM ctop_kuaishou_report_daily_account_ad_scene
+        where stat_date &gt;= DATE_FORMAT(date_sub(now(), interval 8 day), '%Y-%m-%d')
+        AND stat_date &lt;= DATE_FORMAT(date_sub(now(), interval 2 day), '%Y-%m-%d')
+        AND account_id = #{accountId}
+        group by ad_scene
+        order by ad_scene
+    </select>
+</mapper>

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

@@ -0,0 +1,277 @@
+<?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.report.mapper.EtlKuaishouReportAccountDailyMapper">
+    <insert id="replaceBatch">
+        replace into ctop_etl_kuaishou_report_account_daily(
+        stat_date,
+        account_id,
+        charge,
+        photo_show,
+        photo_click,
+        aclick,
+        bclick,
+        photo_share,
+        photo_comment,
+        photo_like,
+        follow,
+        cancel_follow,
+        report,
+        block,
+        negative,
+        download_started,
+        download_completed,
+        activation,
+        submit,
+        event_pay_first_day,
+        event_pay_purchase_amount_first_day,
+        event_pay,
+        event_pay_purchase_amount,
+        event_register,
+        event_jin_jian_app,
+        event_credit_grant_app,
+        event_order_paid,
+        event_order_paid_purchase_amount,
+        event_jin_jian_landing_page,
+        event_credit_grant_landing_page,
+        event_next_day_stay,
+        form_count,
+        play_3s_count
+        )
+        values
+        <foreach collection="list" item="appInfo" separator=",">
+            (
+            #{appInfo.statDate},
+            #{appInfo.accountId},
+            #{appInfo.charge},
+            #{appInfo.photoShow},
+            #{appInfo.photoClick},
+            #{appInfo.aclick},
+            #{appInfo.bclick},
+            #{appInfo.photoShare},
+            #{appInfo.photoComment},
+            #{appInfo.photoLike},
+            #{appInfo.follow},
+            #{appInfo.cancelFollow},
+            #{appInfo.report},
+            #{appInfo.block},
+            #{appInfo.negative},
+            #{appInfo.downloadStarted},
+            #{appInfo.downloadCompleted},
+            #{appInfo.activation},
+            #{appInfo.submit},
+            #{appInfo.eventPayFirstDay},
+            #{appInfo.eventPayPurchaseAmountFirstDay},
+            #{appInfo.eventPay},
+            #{appInfo.eventPayPurchaseAmount},
+            #{appInfo.eventRegister},
+            #{appInfo.eventJinJianApp},
+            #{appInfo.eventCreditGrantApp},
+            #{appInfo.eventOrderPaid},
+            #{appInfo.eventOrderPaidPurchaseAmount},
+            #{appInfo.eventJinJianLandingPage},
+            #{appInfo.eventCreditGrantLandingPage},
+            #{appInfo.eventNextDayStay},
+            #{appInfo.formCount},
+            #{appInfo.play3sCount}
+            )
+        </foreach>
+    </insert>
+
+
+    <select id="getOnedayAggregatebyDaily"
+            resultType="cn.com.ctop.kuaishou.modules.report.entity.EtlKuaishouReportAccountHourly">
+        SELECT stat_date,
+               IFNULL(SUM(charge), 0) as 'charge',
+               SUM(photo_show) as 'photoShow',
+               SUM(photo_click) as 'photoClick',
+               SUM(aclick) as 'aclick',
+               SUM(bclick) as 'bclick',
+               SUM(photo_share) as 'photoShare',
+               SUM(photo_comment) as 'photoComment',
+               SUM(photo_like) as 'photoLike',
+               SUM(follow) as 'follow',
+               SUM(cancel_follow) as 'cancelFollow',
+               SUM(report) as 'report',
+               SUM(block) as 'block',
+               SUM(negative) as 'negative',
+               SUM(download_started) as 'downloadStarted',
+               SUM(download_completed) as 'downloadCompleted',
+               SUM(activation) as 'activation',
+               SUM(submit) as 'submit',
+               SUM(event_pay_first_day) as 'eventPayFirstDay',
+               SUM(event_pay_purchase_amount_first_day) as 'eventPayPurchaseAmountFirstDay',
+               SUM(event_pay) as 'eventPay',
+               SUM(event_pay_purchase_amount) as 'eventPayPurchaseAmount',
+               SUM(event_register) as 'eventRegister',
+               SUM(event_jin_jian_app) as 'eventJinJianApp',
+               SUM(event_credit_grant_app) as 'eventCreditGrantApp',
+               SUM(event_order_paid) as 'eventOrderPaid',
+               SUM(event_order_paid_purchase_amount) as 'eventOrderPaidPurchaseAmount',
+               SUM(event_jin_jian_landing_page) as 'eventJinJianLandingPage',
+               SUM(event_credit_grant_landing_page) as 'eventCreditGrantLandingPage',
+               SUM(event_next_day_stay) as 'eventNextDayStay',
+               SUM(form_count) as 'formCount',
+               SUM(play_3s_count) as 'play3sCount',
+               IFNULL(ROUND(SUM(charge) / SUM(activation), 2), 0) as 'activationCost',
+               IFNULL(ROUND(SUM(charge) / SUM(aclick) * 1000, 2), 0) as 'impression1kCost',
+               IFNULL(ROUND(SUM(charge) / SUM(photo_click), 2), 0) as 'photoClickCost',
+               IFNULL(ROUND(SUM(charge) / SUM(bclick), 2), 0) as 'actionCost',
+               IFNULL(ROUND(SUM(charge) / SUM(download_started), 2), 0) as 'downloadStartedCost',
+               IFNULL(ROUND(SUM(charge) / SUM(download_completed), 2), 0) as 'downloadCompletedCost',
+               IFNULL(ROUND(SUM(charge) / SUM(form_count), 2), 0) as 'formCost',
+               IFNULL(ROUND(SUM(charge) / SUM(event_pay_first_day), 2), 0) as 'eventPayFirstDayCost',
+               IFNULL(ROUND(SUM(charge) / SUM(event_pay), 2), 0) as 'eventPayCost',
+               IFNULL(ROUND(SUM(charge) / SUM(event_register), 2), 0) as 'eventRegisterCost',
+               IFNULL(ROUND(SUM(charge) / SUM(event_next_day_stay), 2), 0) as 'eventNextDayStayCost',
+               IFNULL(ROUND(SUM(charge) / SUM(event_jin_jian_app), 2), 0) as 'eventJinJianAppCost',
+               IFNULL(ROUND(SUM(charge) / SUM(event_credit_grant_app), 2), 0) as 'eventCreditGrantAppCost',
+               IFNULL(ROUND(SUM(charge) / SUM(event_jin_jian_landing_page), 2), 0) as 'eventJinJianLandingPageCost',
+               IFNULL(ROUND(SUM(charge) / SUM(event_credit_grant_landing_page), 2),
+                      0) as 'eventCreditGrantLandingPageCost',
+               IFNULL(ROUND(SUM(charge) / SUM(submit), 2), 0) as 'submitCost',
+               IFNULL(ROUND(SUM(event_pay_purchase_amount_first_day) / SUM(charge) * 100, 2),
+                      0) as 'eventPayFirstDayRoi',
+               IFNULL(ROUND(SUM(event_pay_purchase_amount) / SUM(charge) * 100, 2), 0) as 'eventPayRoi',
+               IFNULL(ROUND(SUM(bclick) / SUM(aclick) * 100, 2), 0) as 'actionRatio',
+               IFNULL(ROUND(SUM(photo_click) / SUM(photo_show) * 100, 2), 0) as 'photoClickRatio',
+               IFNULL(ROUND(SUM(download_started) / SUM(bclick) * 100, 2), 0) as 'downloadStartedRatio',
+               IFNULL(ROUND(SUM(download_completed) / SUM(download_started) * 100, 2), 0) as 'downloadCompletedRatio',
+               IFNULL(ROUND(SUM(activation) / SUM(download_completed) * 100, 2), 0) as 'activationRatio',
+               IFNULL(ROUND(SUM(activation) / SUM(bclick) * 100, 2), 0) as 'clickOnActivationRatio',
+               IFNULL(ROUND(SUM(event_register) / SUM(activation) * 100, 2), 0) as 'eventRegisterRatio',
+               IFNULL(ROUND(SUM(event_next_day_stay) / SUM(activation) * 100, 2), 0) as 'eventNextDayStayRatio',
+               IFNULL(ROUND(SUM(event_credit_grant_app) / SUM(event_jin_jian_app) * 100, 2),
+                      0) as 'eventCreditGrantAppRatio',
+               IFNULL(ROUND(SUM(form_count) / SUM(bclick) * 100, 2), 0) as 'formActionRatio',
+               IFNULL(ROUND(SUM(submit) / SUM(bclick) * 100, 2), 0) as 'submitRatio',
+               IFNULL(ROUND(SUM(play_3s_count) / SUM(photo_show) * 100, 2), 0) as 'play3sRatio'
+        FROM ctop_etl_kuaishou_report_account_daily
+        WHERE account_id = #{accountId}
+          AND stat_date &gt;= #{startTime}
+          AND stat_date &lt;= #{endTime}
+    </select>
+
+
+    <select id="getOnedayEtlReportList" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        <if test="type == 'alone'">
+            IFNULL(${value},0) as 'value',
+        </if>
+        <if test="type == 'more'">
+            <if test="value == 'activationCost'">
+                IFNULL(ROUND(SUM(charge) / SUM(activation), 2), 0) as 'value',
+            </if>
+            <if test="value == 'impression1kCost'">
+                IFNULL(ROUND(SUM(charge) / SUM(aclick) * 1000, 2), 0) as 'value',
+            </if>
+            <if test="value == 'photoClickCost'">
+                IFNULL(ROUND(SUM(charge) / SUM(photo_click), 2), 0) as 'value',
+            </if>
+            <if test="value == 'actionCost'">
+                IFNULL(ROUND(SUM(charge) / SUM(bclick), 2), 0) as 'value',
+            </if>
+            <if test="value == 'play3sRatio'">
+                IFNULL(ROUND(SUM(play_3s_count) / SUM(photo_show) * 100, 2), 0) as 'value',
+            </if>
+            <if test="value == 'downloadStartedCost'">
+                IFNULL(ROUND(SUM(charge) / SUM(download_started), 2), 0) as 'value',
+            </if>
+            <if test="value == 'downloadCompletedCost'">
+                IFNULL(ROUND(SUM(charge) / SUM(download_completed), 2), 0) as 'value',
+            </if>
+            <if test="value == 'formCost'">
+                IFNULL(ROUND(SUM(charge) / SUM(form_count), 2), 0) as 'value',
+            </if>
+            <if test="value == 'eventPayFirstDayCost'">
+                IFNULL(ROUND(SUM(charge) / SUM(event_pay_first_day), 2), 0) as 'value',
+            </if>
+            <if test="value == 'eventPayCost'">
+                IFNULL(ROUND(SUM(charge) / SUM(event_pay), 2), 0) as 'value',
+            </if>
+            <if test="value == 'eventRegisterCost'">
+                IFNULL(ROUND(SUM(charge) / SUM(event_register), 2), 0) as 'value',
+            </if>
+            <if test="value == 'eventNextDayStayCost'">
+                IFNULL(ROUND(SUM(charge) / SUM(event_next_day_stay), 2), 0) as 'value',
+            </if>
+            <if test="value == 'eventJinJianAppCost'">
+                IFNULL(ROUND(SUM(charge) / SUM(event_jin_jian_app), 2), 0) as 'value',
+            </if>
+            <if test="value == 'eventCreditGrantAppCost'">
+                IFNULL(ROUND(SUM(charge) / SUM(event_credit_grant_app), 2), 0) as 'value',
+            </if>
+            <if test="value == 'eventJinJianLandingPageCost'">
+                IFNULL(ROUND(SUM(charge) / SUM(event_jin_jian_landing_page), 2), 0) as 'value',
+            </if>
+            <if test="value == 'eventCreditGrantLandingPageCost'">
+                IFNULL(ROUND(SUM(charge) / SUM(event_credit_grant_landing_page), 2), 0) as 'value',
+            </if>
+            <if test="value == 'submitCost'">
+                IFNULL(ROUND(SUM(charge) / SUM(submit), 2), 0) as 'value',
+            </if>
+            <if test="value == 'eventPayFirstDayRoi'">
+                IFNULL(ROUND(SUM(event_pay_purchase_amount_first_day) / SUM(charge) * 100, 2), 0) as 'value',
+            </if>
+            <if test="value == 'eventPayRoi'">
+                IFNULL(ROUND(SUM(event_pay_purchase_amount) / SUM(charge) * 100, 2), 0) as 'value',
+            </if>
+            <if test="value == 'actionRatio'">
+                IFNULL(ROUND(SUM(bclick) / SUM(aclick) * 100, 2), 0) as 'value',
+            </if>
+            <if test="value == 'photoClickRatio'">
+                IFNULL(ROUND(SUM(photo_click) / SUM(photo_show) * 100, 2), 0) as 'value',
+            </if>
+            <if test="value == 'downloadStartedRatio'">
+                IFNULL(ROUND(SUM(download_started) / SUM(bclick) * 100, 2), 0) as 'value',
+            </if>
+            <if test="value == 'downloadCompletedRatio'">
+                IFNULL(ROUND(SUM(download_completed) / SUM(download_started) * 100, 2), 0) as 'value',
+            </if>
+            <if test="value == 'activationRatio'">
+                IFNULL(ROUND(SUM(activation) / SUM(download_completed) * 100, 2), 0) as 'value',
+            </if>
+            <if test="value == 'eventRegisterRatio'">
+                IFNULL(ROUND(SUM(event_register) / SUM(activation) * 100, 2), 0) as 'value',
+            </if>
+            <if test="value == 'eventNextDayStayRatio'">
+                IFNULL(ROUND(SUM(event_next_day_stay) / SUM(activation) * 100, 2), 0) as 'value',
+            </if>
+            <if test="value == 'eventCreditGrantAppRatio'">
+                IFNULL(ROUND(SUM(event_credit_grant_app) / SUM(event_jin_jian_app) * 100, 2), 0) as 'value',
+            </if>
+            <if test="value == 'formActionRatio'">
+                IFNULL(ROUND(SUM(form_count) / SUM(bclick) * 100, 2), 0) as 'value',
+            </if>
+            <if test="value == 'submitRatio'">
+                IFNULL(ROUND(SUM(submit) / SUM(bclick) * 100, 2), 0) as 'value',
+            </if>
+        </if>
+        stat_date as 'statDate'
+        FROM ctop_etl_kuaishou_report_account_daily
+        WHERE account_id = #{accountId}
+        AND stat_date &gt;= #{startTime}
+        AND stat_date &lt;= #{endTime}
+        group by stat_date
+        order by stat_date
+    </select>
+
+
+    <select id="getMaxChargeAccountId" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT t1.account_id as 'accountId',
+        t1.auth_name as 'accountName'
+        FROM ctop_user_allocation t1
+        LEFT JOIN ctop_etl_kuaishou_report_account_hourly t2 ON t1.account_id = t2.account_id
+        where t2.stat_date = DATE_FORMAT(now(), '%Y-%m-%d')
+        <if test="userId!=null">
+            AND t1.user_id = #{userId}
+        </if>
+        order by charge desc limit 1
+    </select>
+
+    <select id="getNewlyUpdateTime" resultType="java.lang.String">
+        select DATE_FORMAT(update_time,'%Y-%m-%d %H:%i:%s')
+        FROM ctop_etl_kuaishou_report_account_daily
+        ORDER BY update_time desc LIMIT 1
+    </select>
+
+</mapper>

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

@@ -0,0 +1,229 @@
+<?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.report.mapper.EtlKuaishouReportAccountHourlyMapper">
+
+    <insert id="replaceBatch">
+        replace into ctop_etl_kuaishou_report_account_hourly(
+        stat_date,
+        stat_hour,
+        account_id,
+        charge,
+        photo_show,
+        photo_click,
+        aclick,
+        bclick,
+        photo_share,
+        photo_comment,
+        photo_like,
+        follow,
+        cancel_follow,
+        report,
+        block,
+        negative,
+        download_started,
+        download_completed,
+        activation,
+        submit,
+        event_pay_first_day,
+        event_pay_purchase_amount_first_day,
+        event_pay,
+        event_pay_purchase_amount,
+        event_register,
+        event_jin_jian_app,
+        event_credit_grant_app,
+        event_order_paid,
+        event_order_paid_purchase_amount,
+        event_jin_jian_landing_page,
+        event_credit_grant_landing_page,
+        event_next_day_stay,
+        form_count,
+        play_3s_count
+        )
+        values
+        <foreach collection="list" item="appInfo" separator=",">
+            (
+            #{appInfo.statDate},
+            #{appInfo.statHour},
+            #{appInfo.accountId},
+            #{appInfo.charge},
+            #{appInfo.photoShow},
+            #{appInfo.photoClick},
+            #{appInfo.aclick},
+            #{appInfo.bclick},
+            #{appInfo.photoShare},
+            #{appInfo.photoComment},
+            #{appInfo.photoLike},
+            #{appInfo.follow},
+            #{appInfo.cancelFollow},
+            #{appInfo.report},
+            #{appInfo.block},
+            #{appInfo.negative},
+            #{appInfo.downloadStarted},
+            #{appInfo.downloadCompleted},
+            #{appInfo.activation},
+            #{appInfo.submit},
+            #{appInfo.eventPayFirstDay},
+            #{appInfo.eventPayPurchaseAmountFirstDay},
+            #{appInfo.eventPay},
+            #{appInfo.eventPayPurchaseAmount},
+            #{appInfo.eventRegister},
+            #{appInfo.eventJinJianApp},
+            #{appInfo.eventCreditGrantApp},
+            #{appInfo.eventOrderPaid},
+            #{appInfo.eventOrderPaidPurchaseAmount},
+            #{appInfo.eventJinJianLandingPage},
+            #{appInfo.eventCreditGrantLandingPage},
+            #{appInfo.eventNextDayStay},
+            #{appInfo.formCount},
+            #{appInfo.play3sCount}
+            )
+        </foreach>
+    </insert>
+
+    <select id="getOnedayAggregateByHour"
+            resultType="cn.com.ctop.kuaishou.modules.report.entity.EtlKuaishouReportAccountHourly">
+        SELECT *,
+               IFNULL(ROUND(charge / activation, 2), 0) as 'activationCost',
+               IFNULL(ROUND(charge / aclick * 1000, 2), 0) as 'impression1kCost',
+               IFNULL(ROUND(charge / photo_click, 2), 0) as 'photoClickCost',
+               IFNULL(ROUND(charge / bclick, 2), 0) as 'actionCost',
+               IFNULL(ROUND(play_3s_count / photo_show * 100, 2), 0) as 'play3sRatio',
+               IFNULL(ROUND(charge / download_started, 2), 0) as 'downloadStartedCost',
+               IFNULL(ROUND(charge / download_completed, 2), 0) as 'downloadCompletedCost',
+               IFNULL(ROUND(charge / form_count, 2), 0) as 'formCost',
+               IFNULL(ROUND(charge / event_pay_first_day, 2), 0) as 'eventPayFirstDayCost',
+               IFNULL(ROUND(charge / event_pay, 2), 0) as 'eventPayCost',
+               IFNULL(ROUND(charge / event_register, 2), 0) as 'eventRegisterCost',
+               IFNULL(ROUND(charge / event_next_day_stay, 2), 0) as 'eventNextDayStayCost',
+               IFNULL(ROUND(charge / event_jin_jian_app, 2), 0) as 'eventJinJianAppCost',
+               IFNULL(ROUND(charge / event_credit_grant_app, 2), 0) as 'eventCreditGrantAppCost',
+               IFNULL(ROUND(charge / event_jin_jian_landing_page, 2), 0) as 'eventJinJianLandingPageCost',
+               IFNULL(ROUND(charge / event_credit_grant_landing_page, 2), 0) as 'eventCreditGrantLandingPageCost',
+               IFNULL(ROUND(charge / submit, 2), 0) as 'submitCost',
+               IFNULL(ROUND(event_pay_purchase_amount_first_day / charge * 100, 2), 0) as 'eventPayFirstDayRoi',
+               IFNULL(ROUND(event_pay_purchase_amount / charge * 100, 2), 0) as 'eventPayRoi',
+               IFNULL(ROUND(bclick / aclick * 100, 2), 0) as 'actionRatio',
+               IFNULL(ROUND(photo_click / photo_show * 100, 2), 0) as 'photoClickRatio',
+               IFNULL(ROUND(download_started / bclick * 100, 2), 0) as 'downloadStartedRatio',
+               IFNULL(ROUND(download_completed / download_started * 100, 2), 0) as 'downloadCompletedRatio',
+               IFNULL(ROUND(activation / download_completed * 100, 2), 0) as 'activationRatio',
+               IFNULL(ROUND(activation / bclick * 100, 2), 0) as 'clickOnActivationRatio',
+               IFNULL(ROUND(event_register / activation * 100, 2), 0) as 'eventRegisterRatio',
+               IFNULL(ROUND(event_next_day_stay / activation * 100, 2), 0) as 'eventNextDayStayRatio',
+               IFNULL(ROUND(event_credit_grant_app / event_jin_jian_app * 100, 2), 0) as 'eventCreditGrantAppRatio',
+               IFNULL(ROUND(form_count / bclick * 100, 2), 0) as 'formActionRatio',
+               IFNULL(ROUND(submit / bclick * 100, 2), 0) as 'submitRatio'
+        FROM ctop_etl_kuaishou_report_account_hourly
+        WHERE account_id = #{accountId}
+          AND stat_date = #{startTime}
+    </select>
+
+    <select id="getOnedayEtlReportList" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT stat_date as 'statDate',
+        <if test="type == 'alone'">
+            IFNULL(${value},0) as 'value',
+        </if>
+        <if test="type == 'more'">
+            <if test="value == 'activationCost'">
+                IFNULL(ROUND(charge / activation, 2), 0) as 'value',
+            </if>
+            <if test="value == 'impression1kCost'">
+                IFNULL(ROUND(charge / aclick * 1000, 2), 0) as 'value',
+            </if>
+            <if test="value == 'photoClickCost'">
+                IFNULL(ROUND(charge / photo_click, 2), 0) as 'value',
+            </if>
+            <if test="value == 'actionCost'">
+                IFNULL(ROUND(charge / bclick, 2), 0) as 'value',
+            </if>
+            <if test="value == 'play3sCount'">
+                IFNULL(ROUND(play_3s_ratio * photo_show, 2), 0) as 'value',
+            </if>
+            <if test="value == 'downloadStartedCost'">
+                IFNULL(ROUND(charge / download_started, 2), 0) as 'value',
+            </if>
+            <if test="value == 'downloadCompletedCost'">
+                IFNULL(ROUND(charge / download_completed, 2), 0) as 'value',
+            </if>
+            <if test="value == 'formCost'">
+                IFNULL(ROUND(charge / form_count, 2), 0) as 'value',
+            </if>
+            <if test="value == 'eventPayFirstDayCost'">
+                IFNULL(ROUND(charge / event_pay_first_day, 2), 0) as 'value',
+            </if>
+            <if test="value == 'eventPayCost'">
+                IFNULL(ROUND(charge / event_pay, 2), 0) as 'value',
+            </if>
+            <if test="value == 'eventRegisterCost'">
+                IFNULL(ROUND(charge / event_register, 2), 0) as 'value',
+            </if>
+            <if test="value == 'eventNextDayStayCost'">
+                IFNULL(ROUND(charge / event_next_day_stay, 2), 0) as 'value',
+            </if>
+            <if test="value == 'eventJinJianAppCost'">
+                IFNULL(ROUND(charge / event_jin_jian_app, 2), 0) as 'value',
+            </if>
+            <if test="value == 'eventCreditGrantAppCost'">
+                IFNULL(ROUND(charge / event_credit_grant_app, 2), 0) as 'value',
+            </if>
+            <if test="value == 'eventJinJianLandingPageCost'">
+                IFNULL(ROUND(charge / event_jin_jian_landing_page, 2), 0) as 'value',
+            </if>
+            <if test="value == 'eventCreditGrantLandingPageCost'">
+                IFNULL(ROUND(charge / event_credit_grant_landing_page, 2), 0) as 'value',
+            </if>
+            <if test="value == 'submitCost'">
+                IFNULL(ROUND(charge / submit, 2), 0) as 'value',
+            </if>
+            <if test="value == 'eventPayFirstDayRoi'">
+                IFNULL(ROUND(event_pay_purchase_amount_first_day / charge * 100, 2), 0) as 'value',
+            </if>
+            <if test="value == 'eventPayRoi'">
+                IFNULL(ROUND(event_pay_purchase_amount / charge * 100, 2), 0) as 'value',
+            </if>
+            <if test="value == 'actionRatio'">
+                IFNULL(ROUND(bclick / aclick * 100, 2), 0) as 'value',
+            </if>
+            <if test="value == 'photoClickRatio'">
+                IFNULL(ROUND(photo_click / photo_show * 100, 2), 0) as 'value',
+            </if>
+            <if test="value == 'downloadStartedRatio'">
+                IFNULL(ROUND(download_started / bclick * 100, 2), 0) as 'value',
+            </if>
+            <if test="value == 'downloadCompletedRatio'">
+                IFNULL(ROUND(download_completed / download_started * 100, 2), 0) as 'value',
+            </if>
+            <if test="value == 'activationRatio'">
+                IFNULL(ROUND(activation / download_completed * 100, 2), 0) as 'value',
+            </if>
+            <if test="value == 'eventRegisterRatio'">
+                IFNULL(ROUND(event_register / activation * 100, 2), 0) as 'value',
+            </if>
+            <if test="value == 'eventNextDayStayRatio'">
+                IFNULL(ROUND(event_next_day_stay / activation * 100, 2), 0) as 'value',
+            </if>
+            <if test="value == 'eventCreditGrantAppRatio'">
+                IFNULL(ROUND(event_credit_grant_app / event_jin_jian_app * 100, 2), 0) as 'value',
+            </if>
+            <if test="value == 'formActionRatio'">
+                IFNULL(ROUND(form_count / bclick * 100, 2), 0) as 'value',
+            </if>
+            <if test="value == 'submitRatio'">
+                IFNULL(ROUND(submit / bclick * 100, 2), 0) as 'value',
+            </if>
+        </if>
+        stat_hour as 'statHour'
+        FROM ctop_kuaishou_report_hourly_account
+        WHERE account_id = #{accountId}
+        AND stat_date = #{startTime}
+        GROUP BY stat_hour
+        order by stat_hour
+    </select>
+
+    <select id="getNewlyUpdateTime" resultType="java.lang.String">
+        select DATE_FORMAT(update_time,'%Y-%m-%d %H:%i:%s')
+        FROM ctop_etl_kuaishou_report_account_hourly
+        ORDER BY update_time desc LIMIT 1
+    </select>
+
+</mapper>

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

@@ -234,4 +234,27 @@
         limit 9
         ) t1
     </select>
+
+    <select id="queryEveryDayAudienceInfo"
+            resultType="cn.com.ctop.kuaishou.modules.report.entity.EtlKuaishouAudienceAccountDaily">
+        SELECT stat_date,
+               account_id,
+               audience_type,
+               charge,
+               activation,
+               event_pay,
+               event_pay_purchase_amount,
+               event_next_day_stay,
+               aclick,
+               bclick,
+               photo_click,
+               photo_show,
+               gender,
+               age_segment
+        FROM ctop_kuaishou_audience_report_daily_account
+        where stat_date = DATE_FORMAT(date_sub(now(), interval 2 day), '%Y-%m-%d')
+          AND audience_type in ('ageSegment', 'gender')
+    </select>
+
+
 </mapper>

+ 294 - 2
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouReportDailyAccountMapper.xml

@@ -67,7 +67,8 @@
     </resultMap>
 
     <sql id="Base_Column_List">
-    id, account_id, charge, photo_show, aclick, bclick, photo_share, photo_comment, photo_like,
+        id
+        , account_id, charge, photo_show, aclick, bclick, photo_share, photo_comment, photo_like,
     follow, cancel_follow, report, block, negative, download_started, download_completed,
     activation, submit, stat_date, photo_click, photo_click_ratio, action_ratio, impression_1k_cost,
     photo_click_cost, action_cost, event_pay_first_day, event_pay_purchase_amount_first_day,
@@ -79,7 +80,251 @@
     event_credit_grant_landing_ratio, event_next_day_stay_cost, event_next_day_stay_ratio,
     form_action_ratio, event_order_paid_cost, event_next_day_stay, form_cost, form_count,
     play_3s_ratio, create_time, update_time
-  </sql>
+    </sql>
+
+
+    <insert id="replaceBatch">
+        replace into ctop_kuaishou_report_daily_account(
+        account_id,
+        ad_scene,
+        charge,
+        photo_show,
+        aclick,
+        bclick,
+        photo_share,
+        photo_comment,
+        photo_like,
+        follow,
+        cancel_follow,
+        report,
+        block,
+        negative,
+        download_started,
+        download_completed,
+        activation,
+        submit,
+        stat_date,
+        photo_click,
+        photo_click_ratio,
+        action_ratio,
+        impression_1k_cost,
+        photo_click_cost,
+        action_cost,
+        event_pay_first_day,
+        event_pay_purchase_amount_first_day,
+        event_pay_first_day_roi,
+        event_pay,
+        event_pay_purchase_amount,
+        event_pay_roi,
+        event_register,
+        event_register_cost,
+        event_register_ratio,
+        event_jin_jian_app,
+        event_jin_jian_app_cost,
+        event_credit_grant_app,
+        event_credit_grant_app_cost,
+        event_credit_grant_app_ratio,
+        event_order_paid,
+        event_order_paid_purchase_amount,
+        event_jin_jian_landing_page,
+        event_jin_jian_landing_page_cost,
+        event_credit_grant_landing_page,
+        event_credit_grant_landing_page_cost,
+        event_credit_grant_landing_ratio,
+        event_next_day_stay_cost,
+        event_next_day_stay_ratio,
+        form_action_ratio,
+        event_order_paid_cost,
+        event_next_day_stay,
+        form_cost,
+        form_count,
+        play_3s_ratio
+
+        )
+        values
+        <foreach collection="addList" item="add" separator=",">
+            (
+            #{add.accountId},
+            #{add.adScene},
+            #{add.charge},
+            #{add.photoShow},
+            #{add.aclick},
+            #{add.bclick},
+            #{add.photoShare},
+            #{add.photoComment},
+            #{add.photoLike},
+            #{add.follow},
+            #{add.cancelFollow},
+            #{add.report},
+            #{add.block},
+            #{add.negative},
+            #{add.downloadStarted},
+            #{add.downloadCompleted},
+            #{add.activation},
+            #{add.submit},
+            #{add.statDate},
+            #{add.photoClick},
+            #{add.photoClickRatio},
+            #{add.actionRatio},
+            #{add.impression1kCost},
+            #{add.photoClickCost},
+            #{add.actionCost},
+            #{add.eventPayFirstDay},
+            #{add.eventPayPurchaseAmountFirstDay},
+            #{add.eventPayFirstDayRoi},
+            #{add.eventPay},
+            #{add.eventPayPurchaseAmount},
+            #{add.eventPayRoi},
+            #{add.eventRegister},
+            #{add.eventRegisterCost},
+            #{add.eventRegisterRatio},
+            #{add.eventJinJianApp},
+            #{add.eventJinJianAppCost},
+            #{add.eventCreditGrantApp},
+            #{add.eventCreditGrantAppCost},
+            #{add.eventCreditGrantAppRatio},
+            #{add.eventOrderPaid},
+            #{add.eventOrderPaidPurchaseAmount},
+            #{add.eventJinJianLandingPage},
+            #{add.eventJinJianLandingPageCost},
+            #{add.eventCreditGrantLandingPage},
+            #{add.eventCreditGrantLandingPageCost},
+            #{add.eventCreditGrantLandingRatio},
+            #{add.eventNextDayStayCost},
+            #{add.eventNextDayStayRatio},
+            #{add.formActionRatio},
+            #{add.eventOrderPaidCost},
+            #{add.eventNextDayStay},
+            #{add.formCost},
+            #{add.formCount},
+            #{add.play3sRatio}
+
+            )
+        </foreach>
+
+    </insert>
+
+
+    <insert id="replaceBatchAdScene">
+        replace into ctop_kuaishou_report_daily_account_ad_scene(
+        account_id,
+        ad_scene,
+        charge,
+        photo_show,
+        aclick,
+        bclick,
+        photo_share,
+        photo_comment,
+        photo_like,
+        follow,
+        cancel_follow,
+        report,
+        block,
+        negative,
+        download_started,
+        download_completed,
+        activation,
+        submit,
+        stat_date,
+        photo_click,
+        photo_click_ratio,
+        action_ratio,
+        impression_1k_cost,
+        photo_click_cost,
+        action_cost,
+        event_pay_first_day,
+        event_pay_purchase_amount_first_day,
+        event_pay_first_day_roi,
+        event_pay,
+        event_pay_purchase_amount,
+        event_pay_roi,
+        event_register,
+        event_register_cost,
+        event_register_ratio,
+        event_jin_jian_app,
+        event_jin_jian_app_cost,
+        event_credit_grant_app,
+        event_credit_grant_app_cost,
+        event_credit_grant_app_ratio,
+        event_order_paid,
+        event_order_paid_purchase_amount,
+        event_jin_jian_landing_page,
+        event_jin_jian_landing_page_cost,
+        event_credit_grant_landing_page,
+        event_credit_grant_landing_page_cost,
+        event_credit_grant_landing_ratio,
+        event_next_day_stay_cost,
+        event_next_day_stay_ratio,
+        form_action_ratio,
+        event_order_paid_cost,
+        event_next_day_stay,
+        form_cost,
+        form_count,
+        play_3s_ratio
+
+        )
+        values
+        <foreach collection="addList" item="add" separator=",">
+            (
+            #{add.accountId},
+            #{add.adScene},
+            #{add.charge},
+            #{add.photoShow},
+            #{add.aclick},
+            #{add.bclick},
+            #{add.photoShare},
+            #{add.photoComment},
+            #{add.photoLike},
+            #{add.follow},
+            #{add.cancelFollow},
+            #{add.report},
+            #{add.block},
+            #{add.negative},
+            #{add.downloadStarted},
+            #{add.downloadCompleted},
+            #{add.activation},
+            #{add.submit},
+            #{add.statDate},
+            #{add.photoClick},
+            #{add.photoClickRatio},
+            #{add.actionRatio},
+            #{add.impression1kCost},
+            #{add.photoClickCost},
+            #{add.actionCost},
+            #{add.eventPayFirstDay},
+            #{add.eventPayPurchaseAmountFirstDay},
+            #{add.eventPayFirstDayRoi},
+            #{add.eventPay},
+            #{add.eventPayPurchaseAmount},
+            #{add.eventPayRoi},
+            #{add.eventRegister},
+            #{add.eventRegisterCost},
+            #{add.eventRegisterRatio},
+            #{add.eventJinJianApp},
+            #{add.eventJinJianAppCost},
+            #{add.eventCreditGrantApp},
+            #{add.eventCreditGrantAppCost},
+            #{add.eventCreditGrantAppRatio},
+            #{add.eventOrderPaid},
+            #{add.eventOrderPaidPurchaseAmount},
+            #{add.eventJinJianLandingPage},
+            #{add.eventJinJianLandingPageCost},
+            #{add.eventCreditGrantLandingPage},
+            #{add.eventCreditGrantLandingPageCost},
+            #{add.eventCreditGrantLandingRatio},
+            #{add.eventNextDayStayCost},
+            #{add.eventNextDayStayRatio},
+            #{add.formActionRatio},
+            #{add.eventOrderPaidCost},
+            #{add.eventNextDayStay},
+            #{add.formCost},
+            #{add.formCount},
+            #{add.play3sRatio}
+
+            )
+        </foreach>
+
+    </insert>
 
 
     <insert id="insertSelective" parameterType="cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAccount">
@@ -526,6 +771,7 @@
           set account_id = #{accountId}
     </insert>
 
+
     <select id="selectCost" resultType="com.alibaba.fastjson.JSONObject">
         select
             sum(charge) cost,
@@ -1116,6 +1362,7 @@
             limit 50
         </if>
     </select>
+
     <select id="getKuaishouProjectInfoEntity"
             resultType="cn.com.ctop.common.module.vo.KuaishouReportAccountDailyDTOEntity">
         select
@@ -1204,4 +1451,49 @@
 
     </select>
 
+    <select id="queryEveryDayDataForAccount"
+            resultType="cn.com.ctop.kuaishou.modules.report.entity.EtlKuaishouReportAccountDaily">
+    SELECT stat_date,
+           account_id,
+           SUM(charge) as 'charge',
+           SUM(photo_show) as 'photoShow',
+           SUM(photo_click) as 'photoClick',
+           SUM(aclick) as 'aclick',
+           SUM(bclick) as 'bclick',
+           SUM(photo_share) as 'photoShare',
+           SUM(photo_comment) as 'photoComment',
+           SUM(photo_like) as 'photoLike',
+           SUM(follow) as 'follow',
+           SUM(cancel_follow) as 'cancelFollow',
+           SUM(report) as 'report',
+           SUM(block) as 'block',
+           SUM(negative) as 'negative',
+           SUM(download_started) as 'downloadStarted',
+           SUM(download_completed) as 'downloadCompleted',
+           SUM(activation) as 'activation',
+           SUM(submit) as 'submit',
+           SUM(event_pay_first_day) as 'eventPayFirstDay',
+           SUM(event_pay_purchase_amount_first_day) as 'eventPayPurchaseAmountFirstDay',
+           SUM(event_pay) as 'eventPay',
+           SUM(event_pay_purchase_amount) as 'eventPayPurchaseAmount',
+           SUM(event_register) as 'eventRegister',
+           SUM(event_jin_jian_app) as 'eventJinJianApp',
+           SUM(event_credit_grant_app) as 'eventCreditGrantApp',
+           SUM(event_order_paid) as 'eventOrderPaid',
+           SUM(event_order_paid_purchase_amount) as 'eventOrderPaidPurchaseAmount',
+           SUM(event_jin_jian_landing_page) as 'eventJinJianLandingPage',
+           SUM(event_credit_grant_landing_page) as 'eventCreditGrantLandingPage',
+           SUM(event_next_day_stay) as 'eventNextDayStay',
+           SUM(form_count) as 'formCount',
+           ROUND(SUM(play_3s_ratio * photo_show)) as 'play3sCount'
+    FROM ctop_kuaishou_report_daily_account
+    WHERE stat_date = DATE_FORMAT(date_sub(now(), interval 1 day), '%Y-%m-%d')
+    GROUP BY account_id
+    </select>
+    <select id="getSumChargeByAccountIdAndStatDate" resultType="java.math.BigDecimal">
+        select  sum(charge)  from  ctop_kuaishou_report_daily_account
+        where account_id = #{accountId}
+        and stat_date = #{statDate}
+    </select>
+
 </mapper>

+ 254 - 137
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouReportDailyGroupMapper.xml

@@ -108,395 +108,512 @@
     </insert>
 
 
-
-
-
-
-
-
-
-
-
-    <insert id="insertSelective" parameterType="cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyGroup" >
+    <insert id="insertSelective" parameterType="cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyGroup">
         replace into ctop_kuaishou_report_daily_group
-        <trim prefix="(" suffix=")" suffixOverrides="," >
-            <if test="id != null" >
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="id != null">
                 id,
             </if>
-            <if test="accountId != null" >
+            <if test="accountId != null">
                 account_id,
             </if>
-            <if test="unitId != null" >
+            <if test="unitId != null">
                 unit_id,
             </if>
-            <if test="campaignId != null" >
+            <if test="campaignId != null">
                 campaign_id,
             </if>
-            <if test="status != null" >
+            <if test="status != null">
                 status,
             </if>
-            <if test="charge != null" >
+            <if test="charge != null">
                 charge,
             </if>
-            <if test="photoShow != null" >
+            <if test="photoShow != null">
                 photo_show,
             </if>
-            <if test="aclick != null" >
+            <if test="aclick != null">
                 aclick,
             </if>
-            <if test="bclick != null" >
+            <if test="bclick != null">
                 bclick,
             </if>
-            <if test="photoShare != null" >
+            <if test="photoShare != null">
                 photo_share,
             </if>
-            <if test="photoComment != null" >
+            <if test="photoComment != null">
                 photo_comment,
             </if>
-            <if test="photoLike != null" >
+            <if test="photoLike != null">
                 photo_like,
             </if>
-            <if test="follow != null" >
+            <if test="follow != null">
                 follow,
             </if>
-            <if test="cancelFollow != null" >
+            <if test="cancelFollow != null">
                 cancel_follow,
             </if>
-            <if test="report != null" >
+            <if test="report != null">
                 report,
             </if>
-            <if test="block != null" >
+            <if test="block != null">
                 block,
             </if>
-            <if test="negative != null" >
+            <if test="negative != null">
                 negative,
             </if>
-            <if test="downloadStarted != null" >
+            <if test="downloadStarted != null">
                 download_started,
             </if>
-            <if test="downloadCompleted != null" >
+            <if test="downloadCompleted != null">
                 download_completed,
             </if>
-            <if test="activation != null" >
+            <if test="activation != null">
                 activation,
             </if>
-            <if test="submit != null" >
+            <if test="submit != null">
                 submit,
             </if>
-            <if test="statDate != null" >
+            <if test="statDate != null">
                 stat_date,
             </if>
-            <if test="photoClick != null" >
+            <if test="photoClick != null">
                 photo_click,
             </if>
-            <if test="photoClickRatio != null" >
+            <if test="photoClickRatio != null">
                 photo_click_ratio,
             </if>
-            <if test="actionRatio != null" >
+            <if test="actionRatio != null">
                 action_ratio,
             </if>
-            <if test="impression1kCost != null" >
+            <if test="impression1kCost != null">
                 impression_1k_cost,
             </if>
-            <if test="photoClickCost != null" >
+            <if test="photoClickCost != null">
                 photo_click_cost,
             </if>
-            <if test="actionCost != null" >
+            <if test="actionCost != null">
                 action_cost,
             </if>
-            <if test="eventPayFirstDay != null" >
+            <if test="eventPayFirstDay != null">
                 event_pay_first_day,
             </if>
-            <if test="eventPayPurchaseAmountFirstDay != null" >
+            <if test="eventPayPurchaseAmountFirstDay != null">
                 event_pay_purchase_amount_first_day,
             </if>
-            <if test="eventPayFirstDayRoi != null" >
+            <if test="eventPayFirstDayRoi != null">
                 event_pay_first_day_roi,
             </if>
-            <if test="eventPay != null" >
+            <if test="eventPay != null">
                 event_pay,
             </if>
-            <if test="eventPayPurchaseAmount != null" >
+            <if test="eventPayPurchaseAmount != null">
                 event_pay_purchase_amount,
             </if>
-            <if test="eventPayRoi != null" >
+            <if test="eventPayRoi != null">
                 event_pay_roi,
             </if>
-            <if test="eventRegister != null" >
+            <if test="eventRegister != null">
                 event_register,
             </if>
-            <if test="eventRegisterCost != null" >
+            <if test="eventRegisterCost != null">
                 event_register_cost,
             </if>
-            <if test="eventRegisterRatio != null" >
+            <if test="eventRegisterRatio != null">
                 event_register_ratio,
             </if>
-            <if test="eventJinJianApp != null" >
+            <if test="eventJinJianApp != null">
                 event_jin_jian_app,
             </if>
-            <if test="eventJinJianAppCost != null" >
+            <if test="eventJinJianAppCost != null">
                 event_jin_jian_app_cost,
             </if>
-            <if test="eventCreditGrantApp != null" >
+            <if test="eventCreditGrantApp != null">
                 event_credit_grant_app,
             </if>
-            <if test="eventCreditGrantAppCost != null" >
+            <if test="eventCreditGrantAppCost != null">
                 event_credit_grant_app_cost,
             </if>
-            <if test="eventCreditGrantAppRatio != null" >
+            <if test="eventCreditGrantAppRatio != null">
                 event_credit_grant_app_ratio,
             </if>
-            <if test="eventOrderPaid != null" >
+            <if test="eventOrderPaid != null">
                 event_order_paid,
             </if>
-            <if test="eventOrderPaidPurchaseAmount != null" >
+            <if test="eventOrderPaidPurchaseAmount != null">
                 event_order_paid_purchase_amount,
             </if>
-            <if test="eventJinJianLandingPage != null" >
+            <if test="eventJinJianLandingPage != null">
                 event_jin_jian_landing_page,
             </if>
-            <if test="eventJinJianLandingPageCost != null" >
+            <if test="eventJinJianLandingPageCost != null">
                 event_jin_jian_landing_page_cost,
             </if>
-            <if test="eventCreditGrantLandingPage != null" >
+            <if test="eventCreditGrantLandingPage != null">
                 event_credit_grant_landing_page,
             </if>
-            <if test="eventCreditGrantLandingPageCost != null" >
+            <if test="eventCreditGrantLandingPageCost != null">
                 event_credit_grant_landing_page_cost,
             </if>
-            <if test="eventCreditGrantLandingRatio != null" >
+            <if test="eventCreditGrantLandingRatio != null">
                 event_credit_grant_landing_ratio,
             </if>
-            <if test="eventNextDayStayCost != null" >
+            <if test="eventNextDayStayCost != null">
                 event_next_day_stay_cost,
             </if>
-            <if test="eventNextDayStayRatio != null" >
+            <if test="eventNextDayStayRatio != null">
                 event_next_day_stay_ratio,
             </if>
-            <if test="formActionRatio != null" >
+            <if test="formActionRatio != null">
                 form_action_ratio,
             </if>
-            <if test="eventOrderPaidCost != null" >
+            <if test="eventOrderPaidCost != null">
                 event_order_paid_cost,
             </if>
-            <if test="eventNextDayStay != null" >
+            <if test="eventNextDayStay != null">
                 event_next_day_stay,
             </if>
-            <if test="formCost != null" >
+            <if test="formCost != null">
                 form_cost,
             </if>
-            <if test="formCount != null" >
+            <if test="formCount != null">
                 form_count,
             </if>
-            <if test="play3sRatio != null" >
+            <if test="play3sRatio != null">
                 play_3s_ratio,
             </if>
-            <if test="createTime != null" >
+            <if test="createTime != null">
                 create_time,
             </if>
-            <if test="updateTime != null" >
+            <if test="updateTime != null">
                 update_time,
             </if>
-            <if test="channelCode != null" >
+            <if test="channelCode != null">
                 channel_code,
             </if>
-            <if test="unitName != null" >
+            <if test="unitName != null">
                 unit_name,
             </if>
-            <if test="campaignName != null" >
+            <if test="campaignName != null">
                 campaign_name,
             </if>
         </trim>
-        <trim prefix="values (" suffix=")" suffixOverrides="," >
-            <if test="id != null" >
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="id != null">
                 #{id,jdbcType=BIGINT},
             </if>
-            <if test="accountId != null" >
+            <if test="accountId != null">
                 #{accountId,jdbcType=BIGINT},
             </if>
-            <if test="unitId != null" >
+            <if test="unitId != null">
                 #{unitId,jdbcType=BIGINT},
             </if>
-            <if test="campaignId != null" >
+            <if test="campaignId != null">
                 #{campaignId,jdbcType=BIGINT},
             </if>
-            <if test="status != null" >
+            <if test="status != null">
                 #{status,jdbcType=INTEGER},
             </if>
-            <if test="charge != null" >
+            <if test="charge != null">
                 #{charge,jdbcType=DECIMAL},
             </if>
-            <if test="photoShow != null" >
+            <if test="photoShow != null">
                 #{photoShow,jdbcType=BIGINT},
             </if>
-            <if test="aclick != null" >
+            <if test="aclick != null">
                 #{aclick,jdbcType=BIGINT},
             </if>
-            <if test="bclick != null" >
+            <if test="bclick != null">
                 #{bclick,jdbcType=BIGINT},
             </if>
-            <if test="photoShare != null" >
+            <if test="photoShare != null">
                 #{photoShare,jdbcType=BIGINT},
             </if>
-            <if test="photoComment != null" >
+            <if test="photoComment != null">
                 #{photoComment,jdbcType=BIGINT},
             </if>
-            <if test="photoLike != null" >
+            <if test="photoLike != null">
                 #{photoLike,jdbcType=BIGINT},
             </if>
-            <if test="follow != null" >
+            <if test="follow != null">
                 #{follow,jdbcType=BIGINT},
             </if>
-            <if test="cancelFollow != null" >
+            <if test="cancelFollow != null">
                 #{cancelFollow,jdbcType=BIGINT},
             </if>
-            <if test="report != null" >
+            <if test="report != null">
                 #{report,jdbcType=BIGINT},
             </if>
-            <if test="block != null" >
+            <if test="block != null">
                 #{block,jdbcType=BIGINT},
             </if>
-            <if test="negative != null" >
+            <if test="negative != null">
                 #{negative,jdbcType=BIGINT},
             </if>
-            <if test="downloadStarted != null" >
+            <if test="downloadStarted != null">
                 #{downloadStarted,jdbcType=BIGINT},
             </if>
-            <if test="downloadCompleted != null" >
+            <if test="downloadCompleted != null">
                 #{downloadCompleted,jdbcType=BIGINT},
             </if>
-            <if test="activation != null" >
+            <if test="activation != null">
                 #{activation,jdbcType=BIGINT},
             </if>
-            <if test="submit != null" >
+            <if test="submit != null">
                 #{submit,jdbcType=BIGINT},
             </if>
-            <if test="statDate != null" >
+            <if test="statDate != null">
                 #{statDate,jdbcType=VARCHAR},
             </if>
-            <if test="photoClick != null" >
+            <if test="photoClick != null">
                 #{photoClick,jdbcType=BIGINT},
             </if>
-            <if test="photoClickRatio != null" >
+            <if test="photoClickRatio != null">
                 #{photoClickRatio,jdbcType=DOUBLE},
             </if>
-            <if test="actionRatio != null" >
+            <if test="actionRatio != null">
                 #{actionRatio,jdbcType=DOUBLE},
             </if>
-            <if test="impression1kCost != null" >
+            <if test="impression1kCost != null">
                 #{impression1kCost,jdbcType=DECIMAL},
             </if>
-            <if test="photoClickCost != null" >
+            <if test="photoClickCost != null">
                 #{photoClickCost,jdbcType=DECIMAL},
             </if>
-            <if test="actionCost != null" >
+            <if test="actionCost != null">
                 #{actionCost,jdbcType=DECIMAL},
             </if>
-            <if test="eventPayFirstDay != null" >
+            <if test="eventPayFirstDay != null">
                 #{eventPayFirstDay,jdbcType=BIGINT},
             </if>
-            <if test="eventPayPurchaseAmountFirstDay != null" >
+            <if test="eventPayPurchaseAmountFirstDay != null">
                 #{eventPayPurchaseAmountFirstDay,jdbcType=DECIMAL},
             </if>
-            <if test="eventPayFirstDayRoi != null" >
+            <if test="eventPayFirstDayRoi != null">
                 #{eventPayFirstDayRoi,jdbcType=DOUBLE},
             </if>
-            <if test="eventPay != null" >
+            <if test="eventPay != null">
                 #{eventPay,jdbcType=BIGINT},
             </if>
-            <if test="eventPayPurchaseAmount != null" >
+            <if test="eventPayPurchaseAmount != null">
                 #{eventPayPurchaseAmount,jdbcType=DECIMAL},
             </if>
-            <if test="eventPayRoi != null" >
+            <if test="eventPayRoi != null">
                 #{eventPayRoi,jdbcType=DOUBLE},
             </if>
-            <if test="eventRegister != null" >
+            <if test="eventRegister != null">
                 #{eventRegister,jdbcType=BIGINT},
             </if>
-            <if test="eventRegisterCost != null" >
+            <if test="eventRegisterCost != null">
                 #{eventRegisterCost,jdbcType=DECIMAL},
             </if>
-            <if test="eventRegisterRatio != null" >
+            <if test="eventRegisterRatio != null">
                 #{eventRegisterRatio,jdbcType=DOUBLE},
             </if>
-            <if test="eventJinJianApp != null" >
+            <if test="eventJinJianApp != null">
                 #{eventJinJianApp,jdbcType=BIGINT},
             </if>
-            <if test="eventJinJianAppCost != null" >
+            <if test="eventJinJianAppCost != null">
                 #{eventJinJianAppCost,jdbcType=DECIMAL},
             </if>
-            <if test="eventCreditGrantApp != null" >
+            <if test="eventCreditGrantApp != null">
                 #{eventCreditGrantApp,jdbcType=BIGINT},
             </if>
-            <if test="eventCreditGrantAppCost != null" >
+            <if test="eventCreditGrantAppCost != null">
                 #{eventCreditGrantAppCost,jdbcType=DECIMAL},
             </if>
-            <if test="eventCreditGrantAppRatio != null" >
+            <if test="eventCreditGrantAppRatio != null">
                 #{eventCreditGrantAppRatio,jdbcType=DOUBLE},
             </if>
-            <if test="eventOrderPaid != null" >
+            <if test="eventOrderPaid != null">
                 #{eventOrderPaid,jdbcType=BIGINT},
             </if>
-            <if test="eventOrderPaidPurchaseAmount != null" >
+            <if test="eventOrderPaidPurchaseAmount != null">
                 #{eventOrderPaidPurchaseAmount,jdbcType=DECIMAL},
             </if>
-            <if test="eventJinJianLandingPage != null" >
+            <if test="eventJinJianLandingPage != null">
                 #{eventJinJianLandingPage,jdbcType=BIGINT},
             </if>
-            <if test="eventJinJianLandingPageCost != null" >
+            <if test="eventJinJianLandingPageCost != null">
                 #{eventJinJianLandingPageCost,jdbcType=DECIMAL},
             </if>
-            <if test="eventCreditGrantLandingPage != null" >
+            <if test="eventCreditGrantLandingPage != null">
                 #{eventCreditGrantLandingPage,jdbcType=BIGINT},
             </if>
-            <if test="eventCreditGrantLandingPageCost != null" >
+            <if test="eventCreditGrantLandingPageCost != null">
                 #{eventCreditGrantLandingPageCost,jdbcType=DECIMAL},
             </if>
-            <if test="eventCreditGrantLandingRatio != null" >
+            <if test="eventCreditGrantLandingRatio != null">
                 #{eventCreditGrantLandingRatio,jdbcType=DOUBLE},
             </if>
-            <if test="eventNextDayStayCost != null" >
+            <if test="eventNextDayStayCost != null">
                 #{eventNextDayStayCost,jdbcType=DECIMAL},
             </if>
-            <if test="eventNextDayStayRatio != null" >
+            <if test="eventNextDayStayRatio != null">
                 #{eventNextDayStayRatio,jdbcType=BIGINT},
             </if>
-            <if test="formActionRatio != null" >
+            <if test="formActionRatio != null">
                 #{formActionRatio,jdbcType=DOUBLE},
             </if>
-            <if test="eventOrderPaidCost != null" >
+            <if test="eventOrderPaidCost != null">
                 #{eventOrderPaidCost,jdbcType=DECIMAL},
             </if>
-            <if test="eventNextDayStay != null" >
+            <if test="eventNextDayStay != null">
                 #{eventNextDayStay,jdbcType=BIGINT},
             </if>
-            <if test="formCost != null" >
+            <if test="formCost != null">
                 #{formCost,jdbcType=DECIMAL},
             </if>
-            <if test="formCount != null" >
+            <if test="formCount != null">
                 #{formCount,jdbcType=BIGINT},
             </if>
-            <if test="play3sRatio != null" >
+            <if test="play3sRatio != null">
                 #{play3sRatio,jdbcType=DOUBLE},
             </if>
-            <if test="createTime != null" >
+            <if test="createTime != null">
                 #{createTime,jdbcType=TIMESTAMP},
             </if>
-            <if test="updateTime != null" >
+            <if test="updateTime != null">
                 #{updateTime,jdbcType=TIMESTAMP},
             </if>
-            <if test="channelCode != null" >
+            <if test="channelCode != null">
                 #{channelCode,jdbcType=VARCHAR},
             </if>
-            <if test="unitName != null" >
+            <if test="unitName != null">
                 #{unitName,jdbcType=LONGVARCHAR},
             </if>
-            <if test="campaignName != null" >
+            <if test="campaignName != null">
                 #{campaignName,jdbcType=LONGVARCHAR},
             </if>
         </trim>
     </insert>
-
+    <insert id="replaceBatch">
+        replace into ctop_kuaishou_report_daily_group
+        (
+        account_id,
+        unit_id,
+        campaign_id,
+        status,
+        charge,
+        photo_show,
+        aclick,
+        bclick,
+        photo_share,
+        photo_comment,
+        photo_like,
+        follow,
+        cancel_follow,
+        report,
+        block,
+        negative,
+        download_started,
+        download_completed,
+        activation,
+        submit,
+        stat_date,
+        photo_click,
+        photo_click_ratio,
+        action_ratio,
+        impression_1k_cost,
+        photo_click_cost,
+        action_cost,
+        event_pay_first_day,
+        event_pay_purchase_amount_first_day,
+        event_pay_first_day_roi,
+        event_pay,
+        event_pay_purchase_amount,
+        event_pay_roi,
+        event_register,
+        event_register_cost,
+        event_register_ratio,
+        event_jin_jian_app,
+        event_jin_jian_app_cost,
+        event_credit_grant_app,
+        event_credit_grant_app_cost,
+        event_credit_grant_app_ratio,
+        event_order_paid,
+        event_order_paid_purchase_amount,
+        event_jin_jian_landing_page,
+        event_jin_jian_landing_page_cost,
+        event_credit_grant_landing_page,
+        event_credit_grant_landing_page_cost,
+        event_credit_grant_landing_ratio,
+        event_next_day_stay_cost,
+        event_next_day_stay_ratio,
+        form_action_ratio,
+        event_order_paid_cost,
+        event_next_day_stay,
+        form_cost,
+        form_count,
+        play_3s_ratio,
+        channel_code,
+        unit_name,
+        campaign_name)
+        values
+        <foreach collection="addList" item="addList" separator=",">
+            (
+            #{addList.accountId,jdbcType=BIGINT},
+            #{addList.unitId,jdbcType=BIGINT},
+            #{addList.campaignId,jdbcType=BIGINT},
+            #{addList.status,jdbcType=INTEGER},
+            #{addList.charge,jdbcType=DECIMAL},
+            #{addList.photoShow,jdbcType=BIGINT},
+            #{addList.aclick,jdbcType=BIGINT},
+            #{addList.bclick,jdbcType=BIGINT},
+            #{addList.photoShare,jdbcType=BIGINT},
+            #{addList.photoComment,jdbcType=BIGINT},
+            #{addList.photoLike,jdbcType=BIGINT},
+            #{addList.follow,jdbcType=BIGINT},
+            #{addList.cancelFollow,jdbcType=BIGINT},
+            #{addList.report,jdbcType=BIGINT},
+            #{addList.block,jdbcType=BIGINT},
+            #{addList.negative,jdbcType=BIGINT},
+            #{addList.downloadStarted,jdbcType=BIGINT},
+            #{addList.downloadCompleted,jdbcType=BIGINT},
+            #{addList.activation,jdbcType=BIGINT},
+            #{addList.submit,jdbcType=BIGINT},
+            #{addList.statDate,jdbcType=VARCHAR},
+            #{addList.photoClick,jdbcType=BIGINT},
+            #{addList.photoClickRatio,jdbcType=DOUBLE},
+            #{addList.actionRatio,jdbcType=DOUBLE},
+            #{addList.impression1kCost,jdbcType=DECIMAL},
+            #{addList.photoClickCost,jdbcType=DECIMAL},
+            #{addList.actionCost,jdbcType=DECIMAL},
+            #{addList.eventPayFirstDay,jdbcType=BIGINT},
+            #{addList.eventPayPurchaseAmountFirstDay,jdbcType=DECIMAL},
+            #{addList.eventPayFirstDayRoi,jdbcType=DOUBLE},
+            #{addList.eventPay,jdbcType=BIGINT},
+            #{addList.eventPayPurchaseAmount,jdbcType=DECIMAL},
+            #{addList.eventPayRoi,jdbcType=DOUBLE},
+            #{addList.eventRegister,jdbcType=BIGINT},
+            #{addList.eventRegisterCost,jdbcType=DECIMAL},
+            #{addList.eventRegisterRatio,jdbcType=DOUBLE},
+            #{addList.eventJinJianApp,jdbcType=BIGINT},
+            #{addList.eventJinJianAppCost,jdbcType=DECIMAL},
+            #{addList.eventCreditGrantApp,jdbcType=BIGINT},
+            #{addList.eventCreditGrantAppCost,jdbcType=DECIMAL},
+            #{addList.eventCreditGrantAppRatio,jdbcType=DOUBLE},
+            #{addList.eventOrderPaid,jdbcType=BIGINT},
+            #{addList.eventOrderPaidPurchaseAmount,jdbcType=DECIMAL},
+            #{addList.eventJinJianLandingPage,jdbcType=BIGINT},
+            #{addList.eventJinJianLandingPageCost,jdbcType=DECIMAL},
+            #{addList.eventCreditGrantLandingPage,jdbcType=BIGINT},
+            #{addList.eventCreditGrantLandingPageCost,jdbcType=DECIMAL},
+            #{addList.eventCreditGrantLandingRatio,jdbcType=DOUBLE},
+            #{addList.eventNextDayStayCost,jdbcType=DECIMAL},
+            #{addList.eventNextDayStayRatio,jdbcType=BIGINT},
+            #{addList.formActionRatio,jdbcType=DOUBLE},
+            #{addList.eventOrderPaidCost,jdbcType=DECIMAL},
+            #{addList.eventNextDayStay,jdbcType=BIGINT},
+            #{addList.formCost,jdbcType=DECIMAL},
+            #{addList.formCount,jdbcType=BIGINT},
+            #{addList.play3sRatio,jdbcType=DOUBLE},
+            #{addList.channelCode,jdbcType=VARCHAR},
+            #{addList.unitName,jdbcType=LONGVARCHAR},
+            #{addList.campaignName,jdbcType=LONGVARCHAR}
+            )
+        </foreach>
+    </insert>
 
 
 </mapper>

+ 158 - 6
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouReportHourlyAccountMapper.xml

@@ -1,6 +1,118 @@
 <?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.report.mapper.KuaishouReportHourlyAccountMapper">
+    <insert id="replaceBatch">
+        replace into ctop_kuaishou_report_hourly_account(
+        id,
+        account_id,
+        charge,
+        photo_show,
+        aclick,
+        bclick,
+        share,
+        comment,
+        photo_like,
+        follow,
+        cancel_follow,
+        report,
+        block,
+        negative,
+        download_started,
+        download_completed,
+        activation,
+        submit,
+        stat_date,
+        stat_hour,
+        photo_click,
+        photo_click_ratio,
+        action_ratio,
+        impression_1k_cost,
+        photo_click_cost,
+        action_cost,
+        event_pay_first_day,
+        event_pay_purchase_amount_first_day,
+        event_pay_first_day_roi,
+        event_pay,
+        event_pay_purchase_amount,
+        event_pay_roi,
+        event_register,
+        event_register_cost,
+        event_jin_jian_app,
+        event_jin_jian_app_cost,
+        event_credit_grant_app,
+        event_credit_grant_app_cost,
+        event_credit_grant_app_ratio,
+        event_order_paid,
+        event_order_paid_purchase_amount,
+        event_jin_jian_landing_page,
+        event_jin_jian_landing_page_cost,
+        event_credit_grant_landing_page,
+        event_credit_grant_landing_page_cost,
+        form_action_ratio,
+        event_order_paid_cost,
+        event_next_day_stay,
+        form_cost,
+        form_count,
+        play_3s_ratio
+        )
+        values
+        <foreach collection="addList" item="add" separator=",">
+            (
+            #{add.id},
+            #{add.accountId},
+            #{add.charge},
+            #{add.photoShow},
+            #{add.aclick},
+            #{add.bclick},
+            #{add.share},
+            #{add.comment},
+            #{add.photoLike},
+            #{add.follow},
+            #{add.cancelFollow},
+            #{add.report},
+            #{add.block},
+            #{add.negative},
+            #{add.downloadStarted},
+            #{add.downloadCompleted},
+            #{add.activation},
+            #{add.submit},
+            #{add.statDate},
+            #{add.statHour},
+            #{add.photoClick},
+            #{add.photoClickRatio},
+            #{add.actionRatio},
+            #{add.impression1kCost},
+            #{add.photoClickCost},
+            #{add.actionCost},
+            #{add.eventPayFirstDay},
+            #{add.eventPayPurchaseAmountFirstDay},
+            #{add.eventPayFirstDayRoi},
+            #{add.eventPay},
+            #{add.eventPayPurchaseAmount},
+            #{add.eventPayRoi},
+            #{add.eventRegister},
+            #{add.eventRegisterCost},
+            #{add.eventJinJianApp},
+            #{add.eventJinJianAppCost},
+            #{add.eventCreditGrantApp},
+            #{add.eventCreditGrantAppCost},
+            #{add.eventCreditGrantAppRatio},
+            #{add.eventOrderPaid},
+            #{add.eventOrderPaidPurchaseAmount},
+            #{add.eventJinJianLandingPage},
+            #{add.eventJinJianLandingPageCost},
+            #{add.eventCreditGrantLandingPage},
+            #{add.eventCreditGrantLandingPageCost},
+            #{add.formActionRatio},
+            #{add.eventOrderPaidCost},
+            #{add.eventNextDayStay},
+            #{add.formCost},
+            #{add.formCount},
+            #{add.play3sRatio}
+            )
+        </foreach>
+
+    </insert>
 
     <select id="selectMaxHour" resultType="java.lang.Integer">
         select max(stat_hour)
@@ -13,13 +125,53 @@
 
     <select id="getCost" resultType="java.math.BigDecimal">
         select charge
-        from
-        ctop_kuaishou_report_hourly_account
-        where
-        account_id = #{accountId}
-        and stat_date = #{statDate}
-        and stat_hour = #{statHour}
+        from ctop_kuaishou_report_hourly_account
+        where account_id = #{accountId}
+          and stat_date = #{statDate}
+          and stat_hour = #{statHour}
+
+    </select>
 
+    <select id="queryEveryhourlyDataForAccount"
+            resultType="cn.com.ctop.kuaishou.modules.report.entity.EtlKuaishouReportAccountHourly">
+        SELECT stat_date,
+        account_id,
+        DATE_FORMAT(now(), '%H') as 'statHour',
+        SUM(charge) as 'charge',
+        SUM(photo_show) as 'photoShow',
+        SUM(photo_click) as 'photoClick',
+        SUM(aclick) as 'aclick',
+        SUM(bclick) as 'bclick',
+        SUM(share) as 'photoShare',
+        SUM(comment) as 'photoComment',
+        SUM(photo_like) as 'photoLike',
+        SUM(follow) as 'follow',
+        SUM(cancel_follow) as 'cancelFollow',
+        SUM(report) as 'report',
+        SUM(block) as 'block',
+        SUM(negative) as 'negative',
+        SUM(download_started) as 'downloadStarted',
+        SUM(download_completed) as 'downloadCompleted',
+        SUM(activation) as 'activation',
+        SUM(submit) as 'submit',
+        SUM(event_pay_first_day) as 'eventPayFirstDay',
+        SUM(event_pay_purchase_amount_first_day) as 'eventPayPurchaseAmountFirstDay',
+        SUM(event_pay) as 'eventPay',
+        SUM(event_pay_purchase_amount) as 'eventPayPurchaseAmount',
+        SUM(event_register) as 'eventRegister',
+        SUM(event_jin_jian_app) as 'eventJinJianApp',
+        SUM(event_credit_grant_app) as 'eventCreditGrantApp',
+        SUM(event_order_paid) as 'eventOrderPaid',
+        SUM(event_order_paid_purchase_amount) as 'eventOrderPaidPurchaseAmount',
+        SUM(event_jin_jian_landing_page) as 'eventJinJianLandingPage',
+        SUM(event_credit_grant_landing_page) as 'eventCreditGrantLandingPage',
+        SUM(event_next_day_stay) as 'eventNextDayStay',
+        SUM(form_count) as 'formCount',
+        ROUND(SUM(play_3s_ratio * photo_show)) as 'play3sCount'
+        FROM ctop_kuaishou_report_hourly_account
+        WHERE stat_date = DATE_FORMAT(now(), '%Y-%m-%d')
+        AND stat_hour  &lt;= DATE_FORMAT(now(), '%H')
+        GROUP BY account_id
     </select>
 
 </mapper>

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


Some files were not shown because too many files changed in this diff