Browse Source

素材报表

yumeng 4 years ago
parent
commit
a6f52de7d3
32 changed files with 760 additions and 270 deletions
  1. 36 10
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/DateUtils.java
  2. 2 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/mapper/ProjectMapper.java
  3. 6 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/mapper/UserCompanyMapper.java
  4. 17 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/mapper/xml/ProjectMapper.xml
  5. 29 1
      jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/mapper/xml/UserCompanyMapper.xml
  6. 2 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/service/IProjectService.java
  7. 6 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/service/IUserCompanyService.java
  8. 5 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/service/impl/ProjectServiceImpl.java
  9. 11 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/service/impl/UserCompanyServiceImpl.java
  10. 3 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/KuaiShouReportDailyMaterialMapper.java
  11. 6 1
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/KuaiShouVideoGetMapper.java
  12. 53 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouReportDailyMaterialMapper.xml
  13. 37 4
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouVideoGetMapper.xml
  14. 3 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaiShouReportDailyMaterialService.java
  15. 5 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaiShouVideoGetService.java
  16. 7 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouReportDailyMaterialServiceImpl.java
  17. 11 1
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouVideoGetServiceImpl.java
  18. 74 37
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/material/entity/EtlKuaishouVideoInfo.java
  19. 7 2
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/material/mapper/EtlKuaishouVideoInfoMapper.java
  20. 50 7
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/material/mapper/xml/EtlKuaishouVideoInfoMapper.xml
  21. 4 2
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/material/service/IEtlKuaishouVideoInfoService.java
  22. 85 48
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/material/service/impl/EtlKuaishouVideoInfoServiceImpl.java
  23. 26 85
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/KsVideoReportCtrl.java
  24. 100 42
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/EtlKuaishouAccountMaterialReportDaily.java
  25. 14 7
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/EtlKuaishouAccountMaterialReportDailyMapper.java
  26. 80 2
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/EtlKuaishouAccountMaterialReportDailyMapper.xml
  27. 3 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KsVideoReportMapper.xml
  28. 8 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IEtlKuaishouAccountMaterialReportDailyService.java
  29. 51 8
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/EtlKuaishouAccountMaterialReportDailyServiceImpl.java
  30. 15 9
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/TestController.java
  31. 2 2
      jeecg-cloud-module/jeecg-cloud-nacos/pom.xml
  32. 2 2
      jeecg-cloud-module/jeecg-cloud-system-start/pom.xml

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

@@ -1,5 +1,9 @@
 package org.jeecg.common.util;
 package org.jeecg.common.util;
 
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.util.StringUtils;
+
 import java.beans.PropertyEditorSupport;
 import java.beans.PropertyEditorSupport;
 import java.sql.Timestamp;
 import java.sql.Timestamp;
 import java.text.DateFormat;
 import java.text.DateFormat;
@@ -7,11 +11,6 @@ import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.text.SimpleDateFormat;
 import java.util.*;
 import java.util.*;
 
 
-import org.jeecg.common.constant.SystemDateConstant;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.util.StringUtils;
-
 /**
 /**
  * 类描述:时间操作定义类
  * 类描述:时间操作定义类
  *
  *
@@ -63,6 +62,8 @@ public class DateUtils extends PropertyEditorSupport {
             return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
             return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         }
         }
     };
     };
+    public static SimpleDateFormat format1 = new SimpleDateFormat(
+            "yyyy-MM-dd HH:mm:ss");
 
 
     // 以毫秒表示的时间
     // 以毫秒表示的时间
     private static final long DAY_IN_MILLIS = 24 * 3600 * 1000;
     private static final long DAY_IN_MILLIS = 24 * 3600 * 1000;
@@ -71,12 +72,12 @@ public class DateUtils extends PropertyEditorSupport {
     private static final long SECOND_IN_MILLIS = 1000;
     private static final long SECOND_IN_MILLIS = 1000;
 
 
     //系統年月日时间格式
     //系統年月日时间格式
-    public static String yyyy_MM_dd="yyyy-MM-dd";
+    public static String yyyy_MM_dd = "yyyy-MM-dd";
 
 
-    public static String yyyy_MM="yyyy-MM";
+    public static String yyyy_MM = "yyyy-MM";
 
 
     //系统数据起始时间
     //系统数据起始时间
-    public static String BEGIN_TIME="2019-09-01";
+    public static String BEGIN_TIME = "2019-09-01";
 
 
     /**
     /**
      * 时间戳转换为字符串
      * 时间戳转换为字符串
@@ -91,6 +92,7 @@ public class DateUtils extends PropertyEditorSupport {
         }
         }
         return date2Str(date_sdf.get());
         return date2Str(date_sdf.get());
     }
     }
+
     /**
     /**
      * 字符串转换时间戳
      * 字符串转换时间戳
      *
      *
@@ -101,6 +103,7 @@ public class DateUtils extends PropertyEditorSupport {
         Date date = str2Date(str, date_sdf.get());
         Date date = str2Date(str, date_sdf.get());
         return new Timestamp(date.getTime());
         return new Timestamp(date.getTime());
     }
     }
+
     /**
     /**
      * 日期转换为字符串
      * 日期转换为字符串
      *
      *
@@ -122,13 +125,13 @@ public class DateUtils extends PropertyEditorSupport {
     }
     }
 
 
 
 
-
     public static Date addHour(Date date, int hour) {
     public static Date addHour(Date date, int hour) {
         Calendar calendar = Calendar.getInstance();
         Calendar calendar = Calendar.getInstance();
         calendar.setTime(date);
         calendar.setTime(date);
         calendar.add(Calendar.HOUR_OF_DAY, hour);
         calendar.add(Calendar.HOUR_OF_DAY, hour);
         return calendar.getTime();
         return calendar.getTime();
     }
     }
+
     /**
     /**
      * 格式常量
      * 格式常量
      */
      */
@@ -915,6 +918,27 @@ public class DateUtils extends PropertyEditorSupport {
         return new Date(time1);
         return new Date(time1);
     }
     }
 
 
+    public static Date getStartDate(String date) {
+       String temp =  date + " 00:00:00";
+        try {
+            return format1.parse(temp);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return null;
+        }
+
+    }
+
+    public static Date getEndDate(String date) {
+        String temp = date + " 23:59:59";
+        try {
+            return format1.parse(temp);
+        } catch (Exception e) {
+            return null;
+        }
+
+    }
+
 
 
     /**
     /**
      * String类型 转换为Date, 如果参数长度为10 转换格式”yyyy-MM-dd“ 如果参数长度为19 转换格式”yyyy-MM-dd
      * String类型 转换为Date, 如果参数长度为10 转换格式”yyyy-MM-dd“ 如果参数长度为19 转换格式”yyyy-MM-dd
@@ -1513,7 +1537,7 @@ public class DateUtils extends PropertyEditorSupport {
      * 获取指定日期下个月的第一天
      * 获取指定日期下个月的第一天
      *
      *
      * @param dateStr 日期
      * @param dateStr 日期
-     * @param format 格式
+     * @param format  格式
      * @return 数据
      * @return 数据
      */
      */
     public static Map<String, String> getMaxMinDaysOfAddMonth(String dateStr, String format, int addMonth) {
     public static Map<String, String> getMaxMinDaysOfAddMonth(String dateStr, String format, int addMonth) {
@@ -1692,7 +1716,9 @@ public class DateUtils extends PropertyEditorSupport {
 
 
         return days;
         return days;
     }
     }
+
     private static Logger logger = LoggerFactory.getLogger(DateUtils.class);
     private static Logger logger = LoggerFactory.getLogger(DateUtils.class);
+
     /**
     /**
      * 判断time是否在from,to之内
      * 判断time是否在from,to之内
      *
      *

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

@@ -31,4 +31,6 @@ public interface ProjectMapper extends BaseMapper<Project> {
     List<Long> getProjectIdsByProductId(@Param("productId") Long productId);
     List<Long> getProjectIdsByProductId(@Param("productId") Long productId);
 
 
     List<Long> getProjectIdsByProductIdAndNotIn(@Param("productId") Long productId, @Param("partakeProjectIds") List<Long> partakeProjectIds);
     List<Long> getProjectIdsByProductIdAndNotIn(@Param("productId") Long productId, @Param("partakeProjectIds") List<Long> partakeProjectIds);
+
+    JSONObject getProjectByAccountId(@Param("accountId") Long accountId);
 }
 }

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

@@ -3,6 +3,8 @@ package cn.com.ctop.common.module.mapper;
 import cn.com.ctop.common.module.entity.UserCompany;
 import cn.com.ctop.common.module.entity.UserCompany;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+import org.jeecg.common.api.vo.Result;
 
 
 import java.util.List;
 import java.util.List;
 
 
@@ -16,4 +18,8 @@ import java.util.List;
 public interface UserCompanyMapper extends BaseMapper<UserCompany> {
 public interface UserCompanyMapper extends BaseMapper<UserCompany> {
 
 
     List<JSONObject> allCompany();
     List<JSONObject> allCompany();
+
+    JSONObject getCompanyInfoByAccountId(@Param("accountId") Long accountId);
+
+    JSONObject getCompanyInfoByUserId(@Param("userId") String userId);
 }
 }

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

@@ -75,5 +75,22 @@
         </if>
         </if>
 
 
     </select>
     </select>
+    <select id="getProjectByAccountId" resultType="com.alibaba.fastjson.JSONObject">
+    SELECT
+	id AS 'projectId',
+	project_name AS 'projectName'
+    FROM
+	ctop_project
+    WHERE
+	id = (
+		SELECT
+			project_id
+		FROM
+			ctop_user_allocation
+		WHERE
+			account_id = #{accountId}
+		LIMIT 1
+	)
+    </select>
 
 
 </mapper>
 </mapper>

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

@@ -2,11 +2,39 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="cn.com.ctop.common.module.mapper.UserCompanyMapper">
 <mapper namespace="cn.com.ctop.common.module.mapper.UserCompanyMapper">
 
 
-    <select id="allCompany" resultType="com.alibaba.fastjson.JSONObject">
+	<select id="allCompany" resultType="com.alibaba.fastjson.JSONObject">
         SELECT company_id as 'companyId',
         SELECT company_id as 'companyId',
                company_name as 'companyName'
                company_name as 'companyName'
         FROM user_company
         FROM user_company
         GROUP BY company_id
         GROUP BY company_id
     </select>
     </select>
+	<select id="getCompanyInfoByAccountId" resultType="com.alibaba.fastjson.JSONObject">
+    SELECT
+	company_id AS 'companyId',
+	company_name AS 'companyName'
+	FROM
+	user_company
+	WHERE
+	user_id = (
+		SELECT
+			user_id
+		FROM
+			ctop_user_allocation
+		WHERE
+			account_id = #{accountId}
+		LIMIT 1
+	)
+
+    </select>
+	<select id="getCompanyInfoByUserId" resultType="com.alibaba.fastjson.JSONObject">
+	SELECT
+	company_id AS 'companyId',
+	company_name AS 'companyName'
+	FROM
+	user_company
+	WHERE
+	user_id = #{userId}
+	</select>
+
 
 
 </mapper>
 </mapper>

+ 2 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/service/IProjectService.java

@@ -30,4 +30,6 @@ public interface IProjectService extends IService<Project> {
     List<Long> getProjectIdsByProductId(Long productId);
     List<Long> getProjectIdsByProductId(Long productId);
 
 
     List<Long> getProjectIdsByProductIdAndNotIn(Long productId, List<Long> partakeProjectIds);
     List<Long> getProjectIdsByProductIdAndNotIn(Long productId, List<Long> partakeProjectIds);
+
+    JSONObject getProjectByAccountId(Long accountId);
 }
 }

+ 6 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/service/IUserCompanyService.java

@@ -1,6 +1,8 @@
 package cn.com.ctop.common.module.service;
 package cn.com.ctop.common.module.service;
 
 
+
 import cn.com.ctop.common.module.entity.UserCompany;
 import cn.com.ctop.common.module.entity.UserCompany;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.extension.service.IService;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.system.entity.SysUser;
 import org.jeecg.common.system.entity.SysUser;
@@ -21,4 +23,8 @@ public interface IUserCompanyService extends IService<UserCompany> {
     UserCompany getByUserId(String userId);
     UserCompany getByUserId(String userId);
 
 
     Result<Object> allCompany();
     Result<Object> allCompany();
+
+    JSONObject getCompanyInfoByAccountId(Long accountId);
+
+    JSONObject getCompanyInfoByUserId(String clipId);
 }
 }

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

@@ -75,4 +75,9 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
     public List<Long> getProjectIdsByProductIdAndNotIn(Long productId, List<Long> partakeProjectIds) {
     public List<Long> getProjectIdsByProductIdAndNotIn(Long productId, List<Long> partakeProjectIds) {
         return projectMapper.getProjectIdsByProductIdAndNotIn(productId, partakeProjectIds);
         return projectMapper.getProjectIdsByProductIdAndNotIn(productId, partakeProjectIds);
     }
     }
+
+    @Override
+    public JSONObject getProjectByAccountId(Long accountId) {
+        return projectMapper.getProjectByAccountId(accountId);
+    }
 }
 }

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

@@ -1,5 +1,6 @@
 package cn.com.ctop.common.module.service.impl;
 package cn.com.ctop.common.module.service.impl;
 
 
+
 import cn.com.ctop.common.module.entity.SysUserDepart;
 import cn.com.ctop.common.module.entity.SysUserDepart;
 import cn.com.ctop.common.module.entity.UserCompany;
 import cn.com.ctop.common.module.entity.UserCompany;
 import cn.com.ctop.common.module.mapper.SysDepartMapper;
 import cn.com.ctop.common.module.mapper.SysDepartMapper;
@@ -110,4 +111,14 @@ public class UserCompanyServiceImpl extends ServiceImpl<UserCompanyMapper, UserC
         List<JSONObject> data = userCompanyMapper.allCompany();
         List<JSONObject> data = userCompanyMapper.allCompany();
         return Result.ok(data);
         return Result.ok(data);
     }
     }
+
+    @Override
+    public JSONObject getCompanyInfoByAccountId(Long accountId) {
+        return userCompanyMapper.getCompanyInfoByAccountId(accountId);
+    }
+
+    @Override
+    public JSONObject getCompanyInfoByUserId(String clipId) {
+        return userCompanyMapper.getCompanyInfoByUserId(clipId);
+    }
 }
 }

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

@@ -1,6 +1,7 @@
 package cn.com.ctop.kuaishou.modules.batch.mapper;
 package cn.com.ctop.kuaishou.modules.batch.mapper;
 
 
 import cn.com.ctop.kuaishou.modules.batch.entity.vo.KuaiShouVideoGetVo;
 import cn.com.ctop.kuaishou.modules.batch.entity.vo.KuaiShouVideoGetVo;
+import cn.com.ctop.kuaishou.modules.report.entity.EtlKuaishouAccountMaterialReportDaily;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaiShouReportDailyMaterial;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaiShouReportDailyMaterial;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaiShouReportDailyMaterialVo;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaiShouReportDailyMaterialVo;
 import cn.com.ctop.kuaishou.modules.report.entity.VideoGetvo;
 import cn.com.ctop.kuaishou.modules.report.entity.VideoGetvo;
@@ -44,4 +45,6 @@ public interface KuaiShouReportDailyMaterialMapper extends BaseMapper<KuaiShouRe
     List<JSONObject> labelMaterialList(@Param("companyId") String companyId, @Param("realname") String realname, @Param("roleCode") String roleCode, @Param("startTime") String startTime, @Param("endTime") String endTime);
     List<JSONObject> labelMaterialList(@Param("companyId") String companyId, @Param("realname") String realname, @Param("roleCode") String roleCode, @Param("startTime") String startTime, @Param("endTime") String endTime);
 
 
     JSONObject labelMaterialAll(@Param("companyId") String companyId, @Param("realname") String realname, @Param("roleCode") String roleCode, @Param("startTime") String startTime, @Param("endTime") String endTime);
     JSONObject labelMaterialAll(@Param("companyId") String companyId, @Param("realname") String realname, @Param("roleCode") String roleCode, @Param("startTime") String startTime, @Param("endTime") String endTime);
+
+    List<EtlKuaishouAccountMaterialReportDaily> getReportList(@Param("accountId") Long accountId,@Param("statDate") String statDate,@Param("projectId") Long projectId, @Param("projectName") String projectName);
 }
 }

+ 6 - 1
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/KuaiShouVideoGetMapper.java

@@ -8,6 +8,7 @@ import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Param;
 
 
+import java.util.Date;
 import java.util.List;
 import java.util.List;
 import java.util.Map;
 import java.util.Map;
 
 
@@ -55,5 +56,9 @@ public interface KuaiShouVideoGetMapper extends BaseMapper<KuaiShouVideoGet> {
 
 
     List<String> queryPhotoIdsByProjectAndMd5(@Param("projectId") Long projectId, @Param("signature") String signature, @Param("accountId") JSONArray accountId);
     List<String> queryPhotoIdsByProjectAndMd5(@Param("projectId") Long projectId, @Param("signature") String signature, @Param("accountId") JSONArray accountId);
 
 
-    JSONObject getVideoByPhotoIdAndAccountId(@Param("accountId") Long accountId,@Param("photoId") Long photoId);
+    JSONObject getVideoByPhotoIdAndAccountId(@Param("accountId") Long accountId, @Param("photoId") Long photoId);
+
+    List<JSONObject> getVideoListByDate(@Param("startDate") Date startDate,@Param("endDate") Date endDate);
+
+    List<String> getDateList();
 }
 }

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

@@ -873,5 +873,58 @@
         ORDER BY k1.zhenren_charge DESC,k3.zhizuo_charge DESC
         ORDER BY k1.zhenren_charge DESC,k3.zhizuo_charge DESC
         )t
         )t
     </select>
     </select>
+    <select id="getReportList" resultType="cn.com.ctop.kuaishou.modules.report.entity.EtlKuaishouAccountMaterialReportDaily">
+        SELECT
+        #{projectId} as 'projectId',
+        #{projectName} as 'projectName',
+	    t1.account_id AS 'accountId',
+        t1.signature as 'signature',
+	    t1.photo_id AS 'photoId',
+	    sum(t1.charge) AS 'charge',
+	    sum(t1.photo_show) AS 'photoShow',
+	    sum(t1.aclick) AS 'aclick',
+	    sum(t1.bclick) AS 'bclick',
+	    sum(t1.download_started) AS 'downloadStarted',
+	    sum(t1.download_completed) AS 'downloadCompleted',
+	    sum(t1.activation) AS 'activation',
+	    sum(t1.submit) AS 'submit',
+	    t1.stat_date AS 'statDate',
+	    sum(t1.photo_click) AS 'photoClick',
+	    sum(t1.event_pay_first_day) AS 'eventPayFirstDay',
+	    sum(
+		t1.event_pay_purchase_amount_first_day
+	    ) AS 'eventPayPurchaseAmountFirstDay',
+	    sum(t1.event_pay) AS 'eventPay',
+	    sum(
+		t1.event_pay_purchase_amount
+    	) AS 'eventPayPurchaseAmount',
+	    sum(t1.event_register) AS 'eventRegister',
+	    sum(t1.event_jin_jian_app) AS 'eventJinJianApp',
+	    sum(t1.event_credit_grant_app) AS 'eventCreditGrantApp',
+	    sum(t1.event_order_paid) AS 'eventOrderPaid',
+	    sum(
+		t1.event_order_paid_purchase_amount
+	    ) AS 'eventOrderPaidPurchaseAmount',
+	    sum(
+		t1.event_jin_jian_landing_page
+	    ) AS 'eventJinJianLandingPage',
+	    sum(
+		t1.event_credit_grant_landing_page
+	    ) AS 'eventCreditGrantLandingPage',
+	    sum(t1.event_next_day_stay) AS 'eventNextDayStay',
+	    sum(t1.form_count) AS 'formCount',
+	    round(
+		sum(
+			t1.play_3s_ratio * t1.photo_show
+		)
+	    ) AS play3sCount
+        FROM
+	    ctop_kuaishou_report_daily_material t1
+        WHERE
+	    t1.account_id = #{accountId}
+        AND t1.stat_date = #{statDate}
+        GROUP BY
+	    t1.photo_id;
+    </select>
 </mapper>
 </mapper>
 
 

+ 37 - 4
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouVideoGetMapper.xml

@@ -317,11 +317,14 @@
     </select>
     </select>
 
 
     <select id="getAccountIds" resultType="com.alibaba.fastjson.JSONObject">
     <select id="getAccountIds" resultType="com.alibaba.fastjson.JSONObject">
-        SELECT account_id 'accountId',DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 65 MINUTE), '%Y-%m-%d %H:%i:%s') 'startDate'
-        FROM ctop_kuaishou_video_get
+        SELECT t1.account_id 'accountId',DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 15 MINUTE), '%Y-%m-%d %H:%i:%s') 'startDate'
+        FROM ctop_kuaishou_video_get t1
+                 LEFT JOIN ctop_user_allocation t2 ON t1.account_id = t2.account_id
         where channel_type = 1
         where channel_type = 1
-          and status = 0
-        GROUP BY account_id
+          AND t2.account_status = 0
+          AND t1.status = 0
+          AND t1.stat_date >=DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 2 DAY), '%Y-%m-%d')
+        GROUP BY t1.account_id
     </select>
     </select>
 
 
     <select id="queryPhotoIdsByProjectAndMd5" resultType="java.lang.String">
     <select id="queryPhotoIdsByProjectAndMd5" resultType="java.lang.String">
@@ -349,6 +352,36 @@
 
 
     </select>
     </select>
 
 
+    <select id="getVideoListByDate" resultType="com.alibaba.fastjson.JSONObject">
+     SELECT
+     account_id as 'accountId',
+     signature as 'signature',
+     photo_name as 'photoName',
+     url as 'url',
+     cover_url as 'coverUrl',
+     channel_type as 'channelType'
+    from ctop_kuaishou_video_get WHERE stat_date BETWEEN #{startDate} AND #{endDate}
+     group by signature
+
+    </select>
+    <select id="getDateList" resultType="java.lang.String">
+       SELECT
+	    *
+        FROM
+	(
+		SELECT DISTINCT
+			(
+				DATE_FORMAT(stat_date, '%Y-%m-%d')
+			) AS 'date'
+		FROM
+			ctop_kuaishou_video_get
+			where stat_date is  not null
+	) t1
+        ORDER BY
+	t1.date asc
+
+    </select>
+
     <update id="updateBatch">
     <update id="updateBatch">
         UPDATE ctop_kuaishou_video_get SET
         UPDATE ctop_kuaishou_video_get SET
         material_tag = CASE id
         material_tag = CASE id

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

@@ -1,6 +1,7 @@
 package cn.com.ctop.kuaishou.modules.batch.service;
 package cn.com.ctop.kuaishou.modules.batch.service;
 
 
 import cn.com.ctop.kuaishou.modules.batch.entity.vo.KuaiShouVideoGetVo;
 import cn.com.ctop.kuaishou.modules.batch.entity.vo.KuaiShouVideoGetVo;
+import cn.com.ctop.kuaishou.modules.report.entity.EtlKuaishouAccountMaterialReportDaily;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaiShouReportDailyMaterial;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaiShouReportDailyMaterial;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.extension.service.IService;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.api.vo.Result;
@@ -29,4 +30,6 @@ public interface IKuaiShouReportDailyMaterialService extends IService<KuaiShouRe
     List<KuaiShouReportDailyMaterial> getVideoInfoByList(List<KuaiShouReportDailyMaterial> addList, List<Long> photoIdList);
     List<KuaiShouReportDailyMaterial> getVideoInfoByList(List<KuaiShouReportDailyMaterial> addList, List<Long> photoIdList);
 
 
     Result<Object> labelMaterialList(String companyId,String realname, String roleCode, String startTime, String endTime, Integer pageNo, Integer pageSize);
     Result<Object> labelMaterialList(String companyId,String realname, String roleCode, String startTime, String endTime, Integer pageNo, Integer pageSize);
+
+    List<EtlKuaishouAccountMaterialReportDaily> getReportList(Long accountId, String statDate, Long projectId, String projectName);
 }
 }

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

@@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.extension.service.IService;
 
 
+import java.util.Date;
 import java.util.List;
 import java.util.List;
 import java.util.Map;
 import java.util.Map;
 
 
@@ -61,4 +62,8 @@ public interface IKuaiShouVideoGetService extends IService<KuaiShouVideoGet> {
     List<String> queryPhotoIdsByProjectAndMd5(Long projectId, String signature, JSONArray accountId);
     List<String> queryPhotoIdsByProjectAndMd5(Long projectId, String signature, JSONArray accountId);
 
 
     JSONObject getVideoByPhotoIdAndAccountId(Long accountId, Long photoId);
     JSONObject getVideoByPhotoIdAndAccountId(Long accountId, Long photoId);
+
+    List<JSONObject> getVideoListByDate(Date startDate, Date endDate);
+
+    List<String> getDateList();
 }
 }

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

@@ -5,6 +5,7 @@ import cn.com.ctop.common.module.utils.HttpUtils;
 import cn.com.ctop.kuaishou.modules.batch.entity.vo.KuaiShouVideoGetVo;
 import cn.com.ctop.kuaishou.modules.batch.entity.vo.KuaiShouVideoGetVo;
 import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouReportDailyMaterialMapper;
 import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouReportDailyMaterialMapper;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouReportDailyMaterialService;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouReportDailyMaterialService;
+import cn.com.ctop.kuaishou.modules.report.entity.EtlKuaishouAccountMaterialReportDaily;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaiShouReportDailyMaterial;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaiShouReportDailyMaterial;
 import cn.com.ctop.kuaishou.modules.report.mapper.KuaiShouReportHourlyMaterialMapper;
 import cn.com.ctop.kuaishou.modules.report.mapper.KuaiShouReportHourlyMaterialMapper;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONArray;
@@ -14,6 +15,7 @@ import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.github.pagehelper.PageInfo;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.api.vo.Result;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
 import javax.annotation.Resource;
 import javax.annotation.Resource;
@@ -141,6 +143,11 @@ public class KuaiShouReportDailyMaterialServiceImpl extends ServiceImpl<KuaiShou
     }
     }
 
 
     @Override
     @Override
+    public List<EtlKuaishouAccountMaterialReportDaily> getReportList(Long accountId, String statDate, Long projectId, String projectName) {
+        return dailyMaterialMapper.getReportList(accountId, statDate, projectId, projectName);
+    }
+
+    @Override
     public List<KuaiShouReportDailyMaterial> getSignatureByDate(String date) {
     public List<KuaiShouReportDailyMaterial> getSignatureByDate(String date) {
         return dailyMaterialMapper.getSignatureByDate(date);
         return dailyMaterialMapper.getSignatureByDate(date);
     }
     }

+ 11 - 1
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouVideoGetServiceImpl.java

@@ -163,7 +163,7 @@ public class KuaiShouVideoGetServiceImpl extends ServiceImpl<KuaiShouVideoGetMap
             queryWrapper.eq("channel_type", channelType);
             queryWrapper.eq("channel_type", channelType);
         }
         }
 
 
-        if (null != appVersion && !"".equals(appVersion.trim())) {
+        if (null != appVersion && !appVersion.trim().equals("")) {
             queryWrapper.likeRight("photo_name", appVersion);
             queryWrapper.likeRight("photo_name", appVersion);
         }
         }
         if (null != videoCnt && videoCnt != 0) {
         if (null != videoCnt && videoCnt != 0) {
@@ -351,4 +351,14 @@ public class KuaiShouVideoGetServiceImpl extends ServiceImpl<KuaiShouVideoGetMap
     public JSONObject getVideoByPhotoIdAndAccountId(Long accountId, Long photoId) {
     public JSONObject getVideoByPhotoIdAndAccountId(Long accountId, Long photoId) {
         return videoGetMapper.getVideoByPhotoIdAndAccountId(accountId, photoId);
         return videoGetMapper.getVideoByPhotoIdAndAccountId(accountId, photoId);
     }
     }
+
+    @Override
+    public List<JSONObject> getVideoListByDate(Date startDate, Date endDate) {
+        return videoGetMapper.getVideoListByDate(startDate, endDate);
+    }
+
+    @Override
+    public List<String> getDateList() {
+        return videoGetMapper.getDateList();
+    }
 }
 }

+ 74 - 37
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/material/entity/EtlKuaishouVideoInfo.java

@@ -9,48 +9,85 @@ import java.util.Date;
 
 
 /**
 /**
  * 快手视频报表信息
  * 快手视频报表信息
+ *
  * @author jeecg-boot
  * @author jeecg-boot
- * @date   2021-02-20
  * @version V1.0
  * @version V1.0
+ * @date 2021-02-20
  */
  */
 @Data
 @Data
 @TableName("ctop_etl_kuaishou_video_info")
 @TableName("ctop_etl_kuaishou_video_info")
 public class EtlKuaishouVideoInfo {
 public class EtlKuaishouVideoInfo {
 
 
-	/**id*/
-	@TableId(type = IdType.AUTO)
-	private Long id;
-	/**视频唯一标识*/
-	private String videoCode;
-	private String videoName;
-	/**初次产生消耗时间*/
-	private Date stateDate;
-	/**url*/
-	private String url;
-	/**coverUrl*/
-	private String coverUrl;
-	/**渠道类型*/
-	private String channelType;
-	/**渠道名称*/
-	private String channelName;
-	/**planId*/
-	private String planId;
-	/**planName*/
-	private String planName;
-	/**clipId*/
-	private String clipId;
-	/**clipName*/
-	private String clipName;
-	/**shotId*/
-	private String shotId;
-	/**shotName*/
-	private String shotName;
-	/**designTeamLeaderId*/
-	private String designTeamLeaderId;
-	/**designTeamLeaderName*/
-	private String designTeamLeaderName;
-	/**createTime*/
-	private Date createTime;
-	/**updateTime*/
-	private Date updateTime;
+    /**
+     * id
+     */
+    @TableId(type = IdType.AUTO)
+    private Long id;
+    /**
+     * 视频唯一标识
+     */
+    private String companyId;
+    private String companyName;
+    private String videoCode;
+    private String videoName;
+    /**
+     * 初次产生消耗时间
+     */
+    private Date stateDate;
+    /**
+     * url
+     */
+    private String url;
+    /**
+     * coverUrl
+     */
+    private String coverUrl;
+    /**
+     * 渠道类型
+     */
+    private String channelType;
+    /**
+     * 渠道名称
+     */
+    private String channelName;
+    /**
+     * planId
+     */
+    private String planId;
+    /**
+     * planName
+     */
+    private String planName;
+    /**
+     * clipId
+     */
+    private String clipId;
+    /**
+     * clipName
+     */
+    private String clipName;
+    /**
+     * shotId
+     */
+    private String shotId;
+    /**
+     * shotName
+     */
+    private String shotName;
+    /**
+     * designTeamLeaderId
+     */
+    private String designTeamLeaderId;
+    /**
+     * designTeamLeaderName
+     */
+    private String designTeamLeaderName;
+    /**
+     * createTime
+     */
+    private Date createTime;
+    /**
+     * updateTime
+     */
+    private Date updateTime;
 }
 }

+ 7 - 2
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/material/mapper/EtlKuaishouVideoInfoMapper.java

@@ -4,15 +4,20 @@ import cn.com.ctop.kuaishou.modules.material.entity.EtlKuaishouVideoInfo;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Param;
 
 
+import java.util.List;
+
 /**
 /**
  * 快手视频报表信息
  * 快手视频报表信息
+ *
  * @author: jeecg-boot
  * @author: jeecg-boot
- * @date:   2021-02-20
+ * @date: 2021-02-20
  * @cersion: V1.0
  * @cersion: V1.0
  */
  */
 public interface EtlKuaishouVideoInfoMapper extends BaseMapper<EtlKuaishouVideoInfo> {
 public interface EtlKuaishouVideoInfoMapper extends BaseMapper<EtlKuaishouVideoInfo> {
 
 
     String getVideoMinDate(@Param(value = "signature") String signature);
     String getVideoMinDate(@Param(value = "signature") String signature);
 
 
-    void replaceVideoInfo(@Param(value = "etlKuaishouVideoInfo")EtlKuaishouVideoInfo etlKuaishouVideoInfo);
+    void replaceVideoInfo(@Param(value = "etlKuaishouVideoInfo") EtlKuaishouVideoInfo etlKuaishouVideoInfo);
+
+    void addBatch(@Param("addList") List<EtlKuaishouVideoInfo> addList);
 }
 }

+ 50 - 7
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/material/mapper/xml/EtlKuaishouVideoInfoMapper.xml

@@ -4,6 +4,8 @@
     <insert id="replaceVideoInfo" parameterType="cn.com.ctop.kuaishou.modules.material.entity.EtlKuaishouVideoInfo">
     <insert id="replaceVideoInfo" parameterType="cn.com.ctop.kuaishou.modules.material.entity.EtlKuaishouVideoInfo">
         replace into ctop_etl_kuaishou_video_info
         replace into ctop_etl_kuaishou_video_info
             (
             (
+            company_id,
+            company_name,
             video_code,
             video_code,
             video_name,
             video_name,
             state_date,
             state_date,
@@ -21,9 +23,11 @@
             design_team_leader_name)
             design_team_leader_name)
             values
             values
             (
             (
-           #{etlKuaishouVideoInfo.videoCode},
-           #{etlKuaishouVideoInfo.videoName},
-           #{etlKuaishouVideoInfo.stateDate},
+                #{etlKuaishouVideoInfo.companyId},
+                #{etlKuaishouVideoInfo.companyName},
+                #{etlKuaishouVideoInfo.videoCode},
+                #{etlKuaishouVideoInfo.videoName},
+                #{etlKuaishouVideoInfo.stateDate},
                 #{etlKuaishouVideoInfo.url},
                 #{etlKuaishouVideoInfo.url},
                 #{etlKuaishouVideoInfo.coverUrl},
                 #{etlKuaishouVideoInfo.coverUrl},
                 #{etlKuaishouVideoInfo.channelType},
                 #{etlKuaishouVideoInfo.channelType},
@@ -37,10 +41,49 @@
                 #{etlKuaishouVideoInfo.designTeamLeaderId},
                 #{etlKuaishouVideoInfo.designTeamLeaderId},
                 #{etlKuaishouVideoInfo.designTeamLeaderName}
                 #{etlKuaishouVideoInfo.designTeamLeaderName}
         )
         )
-
-
-
-
+    </insert>
+    <insert id="addBatch">
+        replace into ctop_etl_kuaishou_video_info
+        (
+        company_id,
+        company_name,
+        video_code,
+        video_name,
+        state_date,
+        url,
+        cover_url,
+        channel_type,
+        channel_name,
+        plan_id,
+        plan_name,
+        clip_id,
+        clip_name,
+        shot_id,
+        shot_name,
+        design_team_leader_id,
+        design_team_leader_name)
+        values
+        <foreach collection="addList" item="ad" separator=",">
+            (
+            #{ad.companyId},
+            #{ad.companyName},
+            #{ad.videoCode},
+            #{ad.videoName},
+            #{ad.stateDate},
+            #{ad.url},
+            #{ad.coverUrl},
+            #{ad.channelType},
+            #{ad.channelName},
+            #{ad.planId},
+            #{ad.planName},
+            #{ad.clipId},
+            #{ad.clipName},
+            #{ad.shotId},
+            #{ad.shotName},
+            #{ad.designTeamLeaderId},
+            #{ad.designTeamLeaderName}
+            )
+        </foreach>
     </insert>
     </insert>
 
 
     <select id="getVideoMinDate" resultType="java.lang.String">
     <select id="getVideoMinDate" resultType="java.lang.String">

+ 4 - 2
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/material/service/IEtlKuaishouVideoInfoService.java

@@ -6,11 +6,13 @@ import com.baomidou.mybatisplus.extension.service.IService;
 /**
 /**
  * @Description: 快手视频报表信息
  * @Description: 快手视频报表信息
  * @Author: jeecg-boot
  * @Author: jeecg-boot
- * @Date:   2021-02-20
+ * @Date: 2021-02-20
  * @Version: V1.0
  * @Version: V1.0
  */
  */
 public interface IEtlKuaishouVideoInfoService extends IService<EtlKuaishouVideoInfo> {
 public interface IEtlKuaishouVideoInfoService extends IService<EtlKuaishouVideoInfo> {
-    void  etlKuaishouVideoInfo(String date);
+    void etlKuaishouVideoInfo(String date);
 
 
     EtlKuaishouVideoInfo getOneByVideoCode(String signature);
     EtlKuaishouVideoInfo getOneByVideoCode(String signature);
+
+
 }
 }

+ 85 - 48
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/material/service/impl/EtlKuaishouVideoInfoServiceImpl.java

@@ -4,7 +4,8 @@ import cn.com.ctop.common.module.entity.MaterialInfo;
 import cn.com.ctop.common.module.service.IMaterialAscriptionService;
 import cn.com.ctop.common.module.service.IMaterialAscriptionService;
 import cn.com.ctop.common.module.service.IMaterialInfoService;
 import cn.com.ctop.common.module.service.IMaterialInfoService;
 import cn.com.ctop.common.module.service.ISysUserService;
 import cn.com.ctop.common.module.service.ISysUserService;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouVideoGet;
+import cn.com.ctop.common.module.service.IUserCompanyService;
+import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouVideoGetService;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouVideoGetService;
 import cn.com.ctop.kuaishou.modules.material.entity.EtlKuaishouVideoInfo;
 import cn.com.ctop.kuaishou.modules.material.entity.EtlKuaishouVideoInfo;
 import cn.com.ctop.kuaishou.modules.material.mapper.EtlKuaishouVideoInfoMapper;
 import cn.com.ctop.kuaishou.modules.material.mapper.EtlKuaishouVideoInfoMapper;
@@ -12,6 +13,7 @@ import cn.com.ctop.kuaishou.modules.material.service.IEtlKuaishouVideoInfoServic
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.google.common.collect.Lists;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.system.entity.SysUser;
 import org.jeecg.common.system.entity.SysUser;
 import org.jeecg.common.util.DateUtils;
 import org.jeecg.common.util.DateUtils;
@@ -19,17 +21,18 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
 import javax.annotation.Resource;
 import javax.annotation.Resource;
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.Date;
 import java.util.List;
 import java.util.List;
-import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 import java.util.concurrent.Executors;
 
 
 /**
 /**
  * 快手视频报表信息
  * 快手视频报表信息
+ *
  * @author jeecg-boot
  * @author jeecg-boot
- * @date   2021-02-20
  * @version V1.0
  * @version V1.0
+ * @date 2021-02-20
  */
  */
 @Service
 @Service
 @Slf4j
 @Slf4j
@@ -44,100 +47,134 @@ public class EtlKuaishouVideoInfoServiceImpl extends ServiceImpl<EtlKuaishouVide
     private ISysUserService sysUserService;
     private ISysUserService sysUserService;
     @Autowired
     @Autowired
     private IMaterialInfoService materialInfoService;
     private IMaterialInfoService materialInfoService;
-    ExecutorService executorService = Executors.newFixedThreadPool(200);
+    @Autowired
+    private IUserCompanyService companyService;
+    ExecutorService executorService = Executors.newFixedThreadPool(5);
+
     @Override
     @Override
     public void etlKuaishouVideoInfo(String date) {
     public void etlKuaishouVideoInfo(String date) {
-        //1:查询当前日期内的所有存在md5码信息的视频数据
-        List<KuaiShouVideoGet> videoGets = videoGetService.getVideoInfoGroupBySignature(date);
-        if(null!=videoGets&&!videoGets.isEmpty()){
-            CountDownLatch countDownLatch = new CountDownLatch(videoGets.size());
-            videoGets.forEach(videoGet -> {
-                executorService.submit(()->{
+        Date startDate = DateUtils.getStartDate(date);
+        Date endDate = DateUtils.getEndDate(date);
+        List<JSONObject> videoList = videoGetService.getVideoListByDate(startDate, endDate);
+        if (Check.isNull(videoList)) {
+            return;
+        }
+        log.info("日期:{},视频数量:{}", date, videoList.size());
+        List<List<JSONObject>> partition = Lists.partition(videoList, 500);
+        for (int i = 0; i < partition.size(); i++) {
+            List<JSONObject> videos = partition.get(i);
+            executorService.submit(() -> {
+                List<EtlKuaishouVideoInfo> addList = new ArrayList<>();
+                for (int j = 0; j < videos.size(); j++) {
+                    JSONObject videoJson = videos.get(j);
+                    if (Check.isNull(videoJson)) {
+                        continue;
+                    }
+                    String signature = videoJson.getString("signature");
+                    if (Check.isNull(signature)) {
+                        continue;
+                    }
                     try {
                     try {
                         //1:查询素材名称
                         //1:查询素材名称
                         EtlKuaishouVideoInfo etlKuaishouVideoInfo = new EtlKuaishouVideoInfo();
                         EtlKuaishouVideoInfo etlKuaishouVideoInfo = new EtlKuaishouVideoInfo();
-                        MaterialInfo materialInfo = materialInfoService.getMaterialInfoByCode(videoGet.getSignature());
-                        if(null != materialInfo){
+                        MaterialInfo materialInfo = materialInfoService.getMaterialInfoByCode(signature);
+                        if (null != materialInfo) {
                             etlKuaishouVideoInfo.setVideoName(materialInfo.getMaterialName());
                             etlKuaishouVideoInfo.setVideoName(materialInfo.getMaterialName());
-                        }else{
-                            etlKuaishouVideoInfo.setVideoName(videoGet.getPhotoName());
+                        } else {
+                            etlKuaishouVideoInfo.setVideoName(videoJson.getString("photoName"));
                         }
                         }
-                        etlKuaishouVideoInfo.setVideoCode(videoGet.getSignature());
-                        etlKuaishouVideoInfo.setUrl(videoGet.getUrl());
-                        etlKuaishouVideoInfo.setCoverUrl(videoGet.getCoverUrl());
-                        etlKuaishouVideoInfo.setChannelType(videoGet.getChannelType().toString());
-                        if(videoGet.getChannelType() == 0){
+                        etlKuaishouVideoInfo.setVideoCode(signature);
+                        etlKuaishouVideoInfo.setUrl(videoJson.getString("url"));
+                        etlKuaishouVideoInfo.setCoverUrl(videoJson.getString("coverUrl"));
+                        String channelType = videoJson.getString("channelType");
+                        etlKuaishouVideoInfo.setChannelType(channelType);
+                        if (channelType.equals("0")) {
                             etlKuaishouVideoInfo.setChannelName("内部");
                             etlKuaishouVideoInfo.setChannelName("内部");
-                        }else {
+                        } else {
                             etlKuaishouVideoInfo.setChannelName("素造");
                             etlKuaishouVideoInfo.setChannelName("素造");
                         }
                         }
                         //查询相关设计人员信息
                         //查询相关设计人员信息
-                        JSONObject ascription = ascriptionService.getDetailByCode(videoGet.getSignature());
-                        if(null!=ascription){
-                            String clipId = ascription.getString("clipId");
-                            if(null!=clipId&&!"".equals(clipId.trim())){
+                        String clipId = null;
+                        JSONObject ascription = ascriptionService.getDetailByCode(signature);
+                        if (null != ascription) {
+                            clipId = ascription.getString("clipId");
+                            if (null != clipId && !"".equals(clipId.trim())) {
                                 etlKuaishouVideoInfo.setClipId(clipId);
                                 etlKuaishouVideoInfo.setClipId(clipId);
                                 //根据id查询剪辑所属的设计负责人
                                 //根据id查询剪辑所属的设计负责人
                                 SysUser user = sysUserService.getById(clipId);
                                 SysUser user = sysUserService.getById(clipId);
-                                if(null!=user){
+                                if (null != user) {
                                     String roleCode = sysUserService.getRoleCodeByUserId(user.getId());
                                     String roleCode = sysUserService.getRoleCodeByUserId(user.getId());
-                                    if(null!=roleCode&& "designTeamLeader".equals(roleCode.trim())){
+                                    if (null != roleCode && "designTeamLeader".equals(roleCode.trim())) {
                                         etlKuaishouVideoInfo.setDesignTeamLeaderId(user.getId());
                                         etlKuaishouVideoInfo.setDesignTeamLeaderId(user.getId());
                                         etlKuaishouVideoInfo.setDesignTeamLeaderName(user.getRealname());
                                         etlKuaishouVideoInfo.setDesignTeamLeaderName(user.getRealname());
-                                    }else{
+                                    } else {
                                         etlKuaishouVideoInfo.setDesignTeamLeaderId(user.getLeaderId());
                                         etlKuaishouVideoInfo.setDesignTeamLeaderId(user.getLeaderId());
                                         etlKuaishouVideoInfo.setDesignTeamLeaderName(user.getLeaderName());
                                         etlKuaishouVideoInfo.setDesignTeamLeaderName(user.getLeaderName());
                                     }
                                     }
                                 }
                                 }
                             }
                             }
                             String clipName = ascription.getString("clipName");
                             String clipName = ascription.getString("clipName");
-                            if(null!=clipName&&!"".equals(clipName.trim())){
+                            if (null != clipName && !"".equals(clipName.trim())) {
                                 etlKuaishouVideoInfo.setClipName(clipName);
                                 etlKuaishouVideoInfo.setClipName(clipName);
                             }
                             }
                             String planId = ascription.getString("planId");
                             String planId = ascription.getString("planId");
-                            if(null!=planId&&!"".equals(planId.trim())){
+                            if (null != planId && !"".equals(planId.trim())) {
                                 etlKuaishouVideoInfo.setPlanId(planId);
                                 etlKuaishouVideoInfo.setPlanId(planId);
                             }
                             }
                             String planName = ascription.getString("planName");
                             String planName = ascription.getString("planName");
-                            if(null!=planName&&!"".equals(planName.trim())){
+                            if (null != planName && !"".equals(planName.trim())) {
                                 etlKuaishouVideoInfo.setPlanName(planName);
                                 etlKuaishouVideoInfo.setPlanName(planName);
                             }
                             }
                             String shotId = ascription.getString("shotId");
                             String shotId = ascription.getString("shotId");
-                            if(null!=shotId&&!"".equals(shotId.trim())){
+                            if (null != shotId && !"".equals(shotId.trim())) {
                                 etlKuaishouVideoInfo.setShotId(shotId);
                                 etlKuaishouVideoInfo.setShotId(shotId);
                             }
                             }
                             String shotName = ascription.getString("shotName");
                             String shotName = ascription.getString("shotName");
-                            if(null!=shotName&&!"".equals(shotName.trim())){
+                            if (null != shotName && !"".equals(shotName.trim())) {
                                 etlKuaishouVideoInfo.setShotName(shotName);
                                 etlKuaishouVideoInfo.setShotName(shotName);
                             }
                             }
                         }
                         }
+                        if (Check.isNull(clipId)) {
+                            Long accountId = videoJson.getLong("accountId");
+                            if (!Check.isNull(accountId)) {
+                                JSONObject companyJson = companyService.getCompanyInfoByAccountId(accountId);
+                                if (!Check.isNull(companyJson)) {
+                                    etlKuaishouVideoInfo.setCompanyId(companyJson.getString("companyId"));
+                                    etlKuaishouVideoInfo.setCompanyName(companyJson.getString("companyName"));
+                                }
+                            }
+                        } else {
+                            JSONObject companyJson = companyService.getCompanyInfoByUserId(clipId);
+                            etlKuaishouVideoInfo.setCompanyId(companyJson.getString("companyId"));
+                            etlKuaishouVideoInfo.setCompanyName(companyJson.getString("companyName"));
+                        }
                         //查询视频初次消耗时间
                         //查询视频初次消耗时间
-                        String minDate = etlKuaishouVideoInfoMapper.getVideoMinDate(videoGet.getSignature());
-                        if(null!=minDate&&!"".equals(minDate)){
-                            Date getDate = DateUtils.parseDate(minDate,"yyyy-MM-dd");
+                        String minDate = etlKuaishouVideoInfoMapper.getVideoMinDate(signature);
+                        if (null != minDate && !"".equals(minDate)) {
+                            Date getDate = DateUtils.parseDate(minDate, "yyyy-MM-dd");
                             etlKuaishouVideoInfo.setStateDate(getDate);
                             etlKuaishouVideoInfo.setStateDate(getDate);
                         }
                         }
-                        etlKuaishouVideoInfoMapper.replaceVideoInfo(etlKuaishouVideoInfo);
-                    }catch (Exception e){
+                        addList.add(etlKuaishouVideoInfo);
+                    } catch (Exception e) {
                         e.printStackTrace();
                         e.printStackTrace();
-                    }finally {
-                        countDownLatch.countDown();
                     }
                     }
-                });
+                }
+                if (!Check.isNull(addList)) {
+                    etlKuaishouVideoInfoMapper.addBatch(addList);
+
+                }
             });
             });
-            try {
-                countDownLatch.await();
-            } catch (InterruptedException e) {
-                e.printStackTrace();
-            }
-            log.info("{}数据获取完成",date);
         }
         }
+        log.info("{}数据获取完成", date);
     }
     }
+
+
     @Override
     @Override
     public EtlKuaishouVideoInfo getOneByVideoCode(String signature) {
     public EtlKuaishouVideoInfo getOneByVideoCode(String signature) {
-        QueryWrapper<EtlKuaishouVideoInfo>queryWrapper = new QueryWrapper<>();
-        queryWrapper.eq("video_code",signature);
+        QueryWrapper<EtlKuaishouVideoInfo> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("video_code", signature);
         queryWrapper.last("limit 1");
         queryWrapper.last("limit 1");
         return this.getOne(queryWrapper);
         return this.getOne(queryWrapper);
     }
     }
+
 }
 }

+ 26 - 85
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/KsVideoReportCtrl.java

@@ -1,5 +1,7 @@
 package cn.com.ctop.kuaishou.modules.report.controller;
 package cn.com.ctop.kuaishou.modules.report.controller;
 
 
+import cn.com.ctop.common.module.entity.UserCompany;
+import cn.com.ctop.common.module.service.IUserCompanyService;
 import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.ExportExcelUtils;
 import cn.com.ctop.common.module.utils.ExportExcelUtils;
 import cn.com.ctop.common.module.utils.HttpUtils;
 import cn.com.ctop.common.module.utils.HttpUtils;
@@ -9,8 +11,10 @@ import com.alibaba.fastjson.JSONObject;
 import com.github.pagehelper.PageInfo;
 import com.github.pagehelper.PageInfo;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+import org.apache.shiro.SecurityUtils;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.constant.AccountReportConstants;
 import org.jeecg.common.constant.AccountReportConstants;
+import org.jeecg.common.system.vo.LoginUser;
 import org.jeecg.common.utils.JsonResourceUtil;
 import org.jeecg.common.utils.JsonResourceUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -37,6 +41,8 @@ public class KsVideoReportCtrl {
 
 
     @Autowired
     @Autowired
     IKsVideoReportService ksVideoReportService;
     IKsVideoReportService ksVideoReportService;
+    @Autowired
+    private IUserCompanyService companyService;
 
 
 
 
     @PostMapping("/getDesignList")
     @PostMapping("/getDesignList")
@@ -74,6 +80,16 @@ public class KsVideoReportCtrl {
                 throw new Exception("初始化查询 字段返回为空");
                 throw new Exception("初始化查询 字段返回为空");
             }
             }
             Map<String, Object> requestMap = new HashMap<>();
             Map<String, Object> requestMap = new HashMap<>();
+            LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+            String realname = sysUser.getRealname();
+            if (!"管理员".equals(realname) && !"吴睿刚".equals(realname)) {
+                UserCompany userCompany = companyService.getByUserId(sysUser.getId());
+                if (Check.isNull(userCompany)) {
+                    throw new Exception("公司信息为空");
+                }
+                requestMap.put("companyId", userCompany.getCompanyId());
+            }
+
             requestMap.put("filed", filedAll);
             requestMap.put("filed", filedAll);
             requestMap.put("startDate", startDate);
             requestMap.put("startDate", startDate);
             requestMap.put("endDate", endDate);
             requestMap.put("endDate", endDate);
@@ -127,9 +143,7 @@ public class KsVideoReportCtrl {
             String signature = requestBody.getString("signature");
             String signature = requestBody.getString("signature");
             String startDate = requestBody.getString("startDate");
             String startDate = requestBody.getString("startDate");
             String endDate = requestBody.getString("endDate");
             String endDate = requestBody.getString("endDate");
-
             String filedAll = JsonResourceUtil.joinAllFiled(AccountReportConstants.getDicMapKs());
             String filedAll = JsonResourceUtil.joinAllFiled(AccountReportConstants.getDicMapKs());
-
             try {
             try {
                 if (accountIds.isEmpty()) {
                 if (accountIds.isEmpty()) {
                     accountIds = null;
                     accountIds = null;
@@ -145,89 +159,6 @@ public class KsVideoReportCtrl {
         return result;
         return result;
     }
     }
 
 
-    @PostMapping("/excel")
-    public void getExcelReport(@RequestBody JSONObject requestBody,
-                               HttpServletRequest request,
-                               HttpServletResponse response) {
-        //加一个参数区分是table页,还是详情页。
-        String exportType = requestBody.getString("exportType");
-        if (exportType.isEmpty()) {
-            return;
-        }
-        JSONArray columns = requestBody.getJSONArray("columns");
-        if (columns.isEmpty()) {
-            //默认消耗必查
-            columns.add("cost");
-        }
-        String filed = JsonResourceUtil.joinFiled(AccountReportConstants.getDicMapKs(), columns);
-        List<String> titles = new ArrayList<>(JsonResourceUtil.joinTitle(AccountReportConstants.getDicMapKs(), columns));
-        //此处增加两个元素是为了保证数据顺序
-        if ("exportDetail".equals(exportType)) {
-            titles.add(0, "客户");
-            titles.add(1, "项目名称");
-            titles.add(2, "时间");
-            titles.add(3, "消耗");
-            columns.add(0, "advertiserName");
-            columns.add(1, "projectName");
-            columns.add(2, "statDate");
-        } else {
-            titles.add(0, "唯一标识");
-            titles.add(1, "视频");
-            titles.add(2, "视频名称");
-            titles.add(3, "项目名称");
-            titles.add(4, "上传时间");
-            titles.addAll(JsonResourceUtil.joinTitle(AccountReportConstants.getDicMapKs(), columns));
-            columns.add(0, "signature");
-            columns.add(1, "url");
-            columns.add(2, "materialName");
-            columns.add(3, "projectName");
-            columns.add(4, "createTime");
-        }
-
-        JSONArray accountIds = requestBody.getJSONArray("accountIds");
-        if (accountIds.isEmpty()) {
-            accountIds = null;
-        }
-        String startDate = requestBody.getString("startDate");
-        String endDate = requestBody.getString("endDate");
-        String signature = requestBody.getString("signature");
-        String clip = requestBody.getString("clip");
-        String shot = requestBody.getString("shot");
-        String plan = requestBody.getString("plan");
-        String target = requestBody.getString("target");
-        String order = requestBody.getString("order");
-        List<JSONObject> excelData = null;
-        if ("exportTable".equals(exportType)) {
-            excelData = ksVideoReportService.exportExcelReportBy(accountIds, startDate, endDate, filed, target, order, clip, shot, plan);
-        } else if ("exportDetail".equals(exportType)) {
-            excelData = ksVideoReportService.getVideoDetailBy(accountIds, startDate, endDate, filed, signature);
-        }
-        if (null != excelData && excelData.isEmpty()) {
-            return;
-        }
-        List<List<Object>> excelList = new ArrayList<>();
-        excelData.forEach(data -> {
-            List<Object> temp = new ArrayList<>();
-            columns.forEach(k -> {
-                temp.add(data.get(k.toString()));
-            });
-            excelList.add(temp);
-        });
-        try {
-            String[] headers = titles.toArray(new String[titles.size()]);
-            OutputStream os = response.getOutputStream();
-            ExportExcelUtils eeu = new ExportExcelUtils();
-            XSSFWorkbook workbook = new XSSFWorkbook();
-            eeu.exportExcel(workbook, 0, "快手视频报表", headers, excelList);
-            HttpUtils.setResponseHeader(response, "快手视频报表.xlsx");
-            workbook.write(os);
-            os.flush();
-            os.close();
-        } catch (IOException e) {
-            log.error(e.getMessage());
-        }
-    }
-
 
 
     @PostMapping("/excelV2")
     @PostMapping("/excelV2")
     public void excelV2(@RequestBody JSONObject requestBody,
     public void excelV2(@RequestBody JSONObject requestBody,
@@ -282,6 +213,16 @@ public class KsVideoReportCtrl {
             if (!Check.isNull(requestBody.getInteger("channelType"))) {
             if (!Check.isNull(requestBody.getInteger("channelType"))) {
                 requestMap.put("channelType", requestBody.getInteger("channelType"));
                 requestMap.put("channelType", requestBody.getInteger("channelType"));
             }
             }
+            LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+            String realname = sysUser.getRealname();
+            if (!"管理员".equals(realname) && !"吴睿刚".equals(realname)) {
+                UserCompany userCompany = companyService.getByUserId(sysUser.getId());
+                if (Check.isNull(userCompany)) {
+                    throw new Exception("公司信息为空");
+                }
+                requestMap.put("companyId", userCompany.getCompanyId());
+            }
+
 
 
             JSONArray columns2 = new JSONArray();
             JSONArray columns2 = new JSONArray();
             columns2.add(0, "materialName");
             columns2.add(0, "materialName");

+ 100 - 42
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/EtlKuaishouAccountMaterialReportDaily.java

@@ -14,92 +14,150 @@ import java.util.Date;
 
 
 /**
 /**
  * 快手账户素材报表清洗表
  * 快手账户素材报表清洗表
+ *
  * @author jeecg-boot
  * @author jeecg-boot
- * @date   2021-02-25
  * @version V1.0
  * @version V1.0
+ * @date 2021-02-25
  */
  */
 @Data
 @Data
 @TableName("ctop_etl_kuaishou_account_material_report_daily")
 @TableName("ctop_etl_kuaishou_account_material_report_daily")
 @EqualsAndHashCode(callSuper = false)
 @EqualsAndHashCode(callSuper = false)
 @Accessors(chain = true)
 @Accessors(chain = true)
-@ApiModel(value="ctop_etl_kuaishou_account_material_report_daily对象", description="快手账户素材报表清洗表")
+@ApiModel(value = "ctop_etl_kuaishou_account_material_report_daily对象", description = "快手账户素材报表清洗表")
 public class EtlKuaishouAccountMaterialReportDaily {
 public class EtlKuaishouAccountMaterialReportDaily {
 
 
-	/**id*/
+	/**
+	 * id
+	 */
 	@TableId(type = IdType.AUTO)
 	@TableId(type = IdType.AUTO)
 	private Long id;
 	private Long id;
 	private Long photoId;
 	private Long photoId;
-	/**账户ID*/
+	/**
+	 * 账户ID
+	 */
 	private Long accountId;
 	private Long accountId;
-	/**channelType*/
-	private Integer channelType;
-	/**signature*/
+	/**
+	 * signature
+	 */
 	private String signature;
 	private String signature;
-	/**companyId*/
-	private String companyId;
-	/**companyName*/
-	private String companyName;
-	/**projectId*/
+	/**
+	 * projectId
+	 */
 	private String projectId;
 	private String projectId;
-	/**projectName*/
+	/**
+	 * projectName
+	 */
 	private String projectName;
 	private String projectName;
 	/**封面url*/
 	/**封面url*/
-	private String coverUrl;
+
 	/**视频url*/
 	/**视频url*/
-	private String photoUrl;
-	/**素材类型*/
+	/**
+	 * 素材类型
+	 */
 	private String materialType;
 	private String materialType;
-	/**花费(元)*/
+	/**
+	 * 花费(元)
+	 */
 	private BigDecimal charge;
 	private BigDecimal charge;
-	/**曝光数*/
+	/**
+	 * 曝光数
+	 */
 	private Long photoShow;
 	private Long photoShow;
-	/**素材曝光数*/
+	/**
+	 * 素材曝光数
+	 */
 	private Long aclick;
 	private Long aclick;
-	/**行为数*/
+	/**
+	 * 行为数
+	 */
 	private Long bclick;
 	private Long bclick;
-	/**应用下载数据-安卓下载开始数*/
+	/**
+	 * 应用下载数据-安卓下载开始数
+	 */
 	private Long downloadStarted;
 	private Long downloadStarted;
-	/**应用下载数据-安卓下载完成数*/
+	/**
+	 * 应用下载数据-安卓下载完成数
+	 */
 	private Long downloadCompleted;
 	private Long downloadCompleted;
-	/**应用下载数据-激活数*/
+	/**
+	 * 应用下载数据-激活数
+	 */
 	private Long activation;
 	private Long activation;
-	/**提交按钮点击数*/
+	/**
+	 * 提交按钮点击数
+	 */
 	private Long submit;
 	private Long submit;
-	/**日期*/
+	/**
+	 * 日期
+	 */
 	private Date statDate;
 	private Date statDate;
-	/**封面点击数*/
+	/**
+	 * 封面点击数
+	 */
 	private Long photoClick;
 	private Long photoClick;
-	/**应用下载数据-首日付费次数*/
+	/**
+	 * 应用下载数据-首日付费次数
+	 */
 	private Long eventPayFirstDay;
 	private Long eventPayFirstDay;
-	/**应用下载数据-首日付费金额*/
+	/**
+	 * 应用下载数据-首日付费金额
+	 */
 	private BigDecimal eventPayPurchaseAmountFirstDay;
 	private BigDecimal eventPayPurchaseAmountFirstDay;
-	/**应用下载数据-付费次数*/
+	/**
+	 * 应用下载数据-付费次数
+	 */
 	private Long eventPay;
 	private Long eventPay;
-	/**应用下载数据-付费金额*/
+	/**
+	 * 应用下载数据-付费金额
+	 */
 	private BigDecimal eventPayPurchaseAmount;
 	private BigDecimal eventPayPurchaseAmount;
-	/**应用下载数据-注册数*/
+	/**
+	 * 应用下载数据-注册数
+	 */
 	private Long eventRegister;
 	private Long eventRegister;
-	/**应用下载数据-完件数*/
+	/**
+	 * 应用下载数据-完件数
+	 */
 	private Long eventJinJianApp;
 	private Long eventJinJianApp;
-	/**应用下载数据-授信数*/
+	/**
+	 * 应用下载数据-授信数
+	 */
 	private Long eventCreditGrantApp;
 	private Long eventCreditGrantApp;
-	/**应用下载数据-付款成功数*/
+	/**
+	 * 应用下载数据-付款成功数
+	 */
 	private Long eventOrderPaid;
 	private Long eventOrderPaid;
-	/**应用下载数据-付款成功金额*/
+	/**
+	 * 应用下载数据-付款成功金额
+	 */
 	private BigDecimal eventOrderPaidPurchaseAmount;
 	private BigDecimal eventOrderPaidPurchaseAmount;
-	/**落地页数据-落地页完件数*/
+	/**
+	 * 落地页数据-落地页完件数
+	 */
 	private Long eventJinJianLandingPage;
 	private Long eventJinJianLandingPage;
-	/**落地页数据-落地页授信数*/
+	/**
+	 * 落地页数据-落地页授信数
+	 */
 	private Long eventCreditGrantLandingPage;
 	private Long eventCreditGrantLandingPage;
-	/**应用下载数据-次留数(仅支持分日查询)*/
+	/**
+	 * 应用下载数据-次留数(仅支持分日查询)
+	 */
 	private Long eventNextDayStay;
 	private Long eventNextDayStay;
-	/**落地页数据-表单提交数*/
+	/**
+	 * 落地页数据-表单提交数
+	 */
 	private Long formCount;
 	private Long formCount;
-	/**3s播放数*/
+	/**
+	 * 3s播放数
+	 */
 	@TableField(value = "play_3s_count")
 	@TableField(value = "play_3s_count")
 	private Long play3sCount;
 	private Long play3sCount;
-	/**创建时间*/
+	/**
+	 * 创建时间
+	 */
 	private Date createTime;
 	private Date createTime;
-	/**修改时间*/
+	/**
+	 * 修改时间
+	 */
 	private Date updateTime;
 	private Date updateTime;
 }
 }

+ 14 - 7
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/EtlKuaishouAccountMaterialReportDailyMapper.java

@@ -8,19 +8,20 @@ import java.util.List;
 
 
 /**
 /**
  * 快手账户素材报表清洗表
  * 快手账户素材报表清洗表
+ *
  * @author: jeecg-boot
  * @author: jeecg-boot
- * @date:   2021-02-25
+ * @date: 2021-02-25
  * @cersion: V1.0
  * @cersion: V1.0
  */
  */
 public interface EtlKuaishouAccountMaterialReportDailyMapper extends BaseMapper<EtlKuaishouAccountMaterialReportDaily> {
 public interface EtlKuaishouAccountMaterialReportDailyMapper extends BaseMapper<EtlKuaishouAccountMaterialReportDaily> {
 
 
     void etlKuaishouAccountMaterialReportDailyData(@Param(value = "date") String date);
     void etlKuaishouAccountMaterialReportDailyData(@Param(value = "date") String date);
 
 
-    List<EtlKuaishouAccountMaterialReportDaily> etlKuaishouAccountMaterialReportDailyList(@Param(value = "date")String date,@Param(value = "accountId")Long accountId);
+    List<EtlKuaishouAccountMaterialReportDaily> etlKuaishouAccountMaterialReportDailyList(@Param(value = "date") String date, @Param(value = "accountId") Long accountId);
 
 
-    void replaceBatch(@Param(value = "records")List<EtlKuaishouAccountMaterialReportDaily> getList);
+    void replaceBatch(@Param(value = "records") List<EtlKuaishouAccountMaterialReportDaily> getList);
 
 
-    void replace(@Param(value = "report")EtlKuaishouAccountMaterialReportDaily report);
+    void replace(@Param(value = "report") EtlKuaishouAccountMaterialReportDaily report);
 
 
     void etlKuaishouVideoReportStateDate();
     void etlKuaishouVideoReportStateDate();
 
 
@@ -28,9 +29,15 @@ public interface EtlKuaishouAccountMaterialReportDailyMapper extends BaseMapper<
 
 
     void etlKuaishouVideoTypeZz(@Param(value = "videoType") String videoType);
     void etlKuaishouVideoTypeZz(@Param(value = "videoType") String videoType);
 
 
-    void etlKuaishouVideoTypeZr(@Param(value = "videoType")String videoType);
+    void etlKuaishouVideoTypeZr(@Param(value = "videoType") String videoType);
 
 
-    void etlBytedanceVideoTypeZr(@Param(value = "videoType")String videoType);
+    void etlBytedanceVideoTypeZr(@Param(value = "videoType") String videoType);
 
 
-    void etlBytedanceVideoTypeZz(@Param(value = "videoType")String videoType);
+    void etlBytedanceVideoTypeZz(@Param(value = "videoType") String videoType);
+
+    void addBatch(@Param("addList") List<EtlKuaishouAccountMaterialReportDaily> addList);
+
+    List<String> getDateList();
+
+    List<Long> getAccountList(String date);
 }
 }

+ 80 - 2
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/EtlKuaishouAccountMaterialReportDailyMapper.xml

@@ -144,7 +144,9 @@
     </insert>
     </insert>
     <insert id="replace">
     <insert id="replace">
     replace into ctop_etl_kuaishou_account_material_report_daily(
     replace into ctop_etl_kuaishou_account_material_report_daily(
-        photo_id,photo_url,cover_url
+        photo_id,
+        photo_url,
+        cover_url,
         company_id ,
         company_id ,
         company_name ,
         company_name ,
         project_id ,
         project_id ,
@@ -177,7 +179,7 @@
         play_3s_count)
         play_3s_count)
         values
         values
         (
         (
-    #{report.photoId},
+       #{report.photoId},
     #{report.photoUrl},
     #{report.photoUrl},
     #{report.coverUrl},
     #{report.coverUrl},
             #{report.companyId},
             #{report.companyId},
@@ -212,6 +214,7 @@
             #{report.play3sCount}
             #{report.play3sCount}
         )
         )
     </insert>
     </insert>
+
     <update id="etlKuaishouVideoReportStateDate">
     <update id="etlKuaishouVideoReportStateDate">
         UPDATE ctop_etl_kuaishou_video_info info
         UPDATE ctop_etl_kuaishou_video_info info
             LEFT JOIN ( select video_code,min(report.stat_date) as minDate from ctop_kuaishou_report_daily_material report left join ctop_kuaishou_video_get ckvg on report.account_id = ckvg.account_id
             LEFT JOIN ( select video_code,min(report.stat_date) as minDate from ctop_kuaishou_report_daily_material report left join ctop_kuaishou_video_get ckvg on report.account_id = ckvg.account_id
@@ -289,6 +292,81 @@ where 1=1
 and m.stat_date = #{date} and m.account_id = #{accountId}
 and m.stat_date = #{date} and m.account_id = #{accountId}
 group by m.account_id,m.photo_id
 group by m.account_id,m.photo_id
     </select>
     </select>
+    <select id="getDateList" resultType="java.lang.String">
+        SELECT DISTINCT stat_date  from  ctop_kuaishou_report_daily_material ORDER BY stat_date DESC
+    </select>
+    <select id="getAccountList" resultType="java.lang.Long">
+       SELECT DISTINCT account_id  from  ctop_kuaishou_report_daily_material where stat_date = #{date}
+    </select>
+
+
+    <insert id="addBatch">
+        replace into ctop_etl_kuaishou_account_material_report_daily(
+        project_id,
+        project_name,
+        photo_id,
+        account_id,
+        signature,
+        charge,
+        photo_show,
+        aclick,
+        bclick,
+        download_started,
+        download_completed,
+        activation,
+        submit,
+        stat_date,
+        photo_click,
+        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="addList" item="report" separator=",">
+            (
+            #{report.projectId},
+            #{report.projectName},
+            #{report.photoId},
+            #{report.accountId},
+            #{report.signature},
+            #{report.charge},
+            #{report.photoShow},
+            #{report.aclick},
+            #{report.bclick},
+            #{report.downloadStarted},
+            #{report.downloadCompleted},
+            #{report.activation},
+            #{report.submit},
+            #{report.statDate},
+            #{report.photoClick},
+            #{report.eventPayFirstDay},
+            #{report.eventPayPurchaseAmountFirstDay},
+            #{report.eventPay},
+            #{report.eventPayPurchaseAmount},
+            #{report.eventRegister},
+            #{report.eventJinJianApp},
+            #{report.eventCreditGrantApp},
+            #{report.eventOrderPaid},
+            #{report.eventOrderPaidPurchaseAmount},
+            #{report.eventJinJianLandingPage},
+            #{report.eventCreditGrantLandingPage},
+            #{report.eventNextDayStay},
+            #{report.formCount},
+            #{report.play3sCount}
+            )
+        </foreach>
+
+    </insert>
 
 
 
 
 </mapper>
 </mapper>

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

@@ -52,6 +52,9 @@
         <if test="shotId !=null and shotId != ''">
         <if test="shotId !=null and shotId != ''">
             AND t2.shot_id = #{shotId}
             AND t2.shot_id = #{shotId}
         </if>
         </if>
+        <if test="companyId !=null and companyId != ''">
+            AND t2.company_id = #{companyId}
+        </if>
         ORDER BY ${target} ${order}
         ORDER BY ${target} ${order}
     </select>
     </select>
 
 

+ 8 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IEtlKuaishouAccountMaterialReportDailyService.java

@@ -3,6 +3,8 @@ package cn.com.ctop.kuaishou.modules.report.service;
 import cn.com.ctop.kuaishou.modules.report.entity.EtlKuaishouAccountMaterialReportDaily;
 import cn.com.ctop.kuaishou.modules.report.entity.EtlKuaishouAccountMaterialReportDaily;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.extension.service.IService;
 
 
+import java.util.List;
+
 /**
 /**
  * @Description: 快手账户素材报表清洗表
  * @Description: 快手账户素材报表清洗表
  * @Author: jeecg-boot
  * @Author: jeecg-boot
@@ -19,4 +21,10 @@ public interface IEtlKuaishouAccountMaterialReportDailyService extends IService<
 
 
     void etlKuaishouVideoType();
     void etlKuaishouVideoType();
 
 
+    void cleanVideoInfo(Long accountId,String statDate);
+
+
+    List<String> getDateList();
+
+    List<Long> getAccountListByDate(String date);
 }
 }

+ 51 - 8
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/EtlKuaishouAccountMaterialReportDailyServiceImpl.java

@@ -2,11 +2,16 @@ package cn.com.ctop.kuaishou.modules.report.service.impl;
 
 
 import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
+import cn.com.ctop.common.module.service.IProjectService;
+import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.CtopAdConstant;
 import cn.com.ctop.common.module.utils.CtopAdConstant;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouReportDailyMaterialService;
 import cn.com.ctop.kuaishou.modules.report.entity.EtlKuaishouAccountMaterialReportDaily;
 import cn.com.ctop.kuaishou.modules.report.entity.EtlKuaishouAccountMaterialReportDaily;
 import cn.com.ctop.kuaishou.modules.report.mapper.EtlKuaishouAccountMaterialReportDailyMapper;
 import cn.com.ctop.kuaishou.modules.report.mapper.EtlKuaishouAccountMaterialReportDailyMapper;
 import cn.com.ctop.kuaishou.modules.report.service.IEtlKuaishouAccountMaterialReportDailyService;
 import cn.com.ctop.kuaishou.modules.report.service.IEtlKuaishouAccountMaterialReportDailyService;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.google.common.collect.Lists;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
@@ -19,9 +24,10 @@ import java.util.concurrent.Executors;
 
 
 /**
 /**
  * 快手账户素材报表清洗表
  * 快手账户素材报表清洗表
+ *
  * @author jeecg-boot
  * @author jeecg-boot
- * @date   2021-02-25
  * @version V1.0
  * @version V1.0
+ * @date 2021-02-25
  */
  */
 @Service
 @Service
 @Slf4j
 @Slf4j
@@ -30,21 +36,24 @@ public class EtlKuaishouAccountMaterialReportDailyServiceImpl extends ServiceImp
     private EtlKuaishouAccountMaterialReportDailyMapper etlKuaishouAccountMaterialReportDailyMapper;
     private EtlKuaishouAccountMaterialReportDailyMapper etlKuaishouAccountMaterialReportDailyMapper;
     @Autowired
     @Autowired
     private ICtopOauthTokenService tokenService;
     private ICtopOauthTokenService tokenService;
+    @Autowired
+    private IKuaiShouReportDailyMaterialService dailyMaterialService;
     static ExecutorService etlExecutorService = Executors.newFixedThreadPool(10);
     static ExecutorService etlExecutorService = Executors.newFixedThreadPool(10);
+    static ExecutorService accountEtlExecutorService = Executors.newFixedThreadPool(10);
 
 
     @Override
     @Override
     public void etlKuaishouAccountMaterialReportInfo(String formatDate) {
     public void etlKuaishouAccountMaterialReportInfo(String formatDate) {
         List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
         List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
         CountDownLatch countDownLatch = new CountDownLatch(tokens.size());
         CountDownLatch countDownLatch = new CountDownLatch(tokens.size());
-        tokens.forEach(token -> etlExecutorService.submit(()->{
+        tokens.forEach(token -> etlExecutorService.submit(() -> {
             try {
             try {
-                List<EtlKuaishouAccountMaterialReportDaily> getList = etlKuaishouAccountMaterialReportDailyMapper.etlKuaishouAccountMaterialReportDailyList(formatDate,token.getAccountId());
-                if(null!=getList&&!getList.isEmpty()){
-                    getList.forEach(report->etlKuaishouAccountMaterialReportDailyMapper.replace(report));
+                List<EtlKuaishouAccountMaterialReportDaily> getList = etlKuaishouAccountMaterialReportDailyMapper.etlKuaishouAccountMaterialReportDailyList(formatDate, token.getAccountId());
+                if (null != getList && !getList.isEmpty()) {
+                    getList.forEach(report -> etlKuaishouAccountMaterialReportDailyMapper.replace(report));
                 }
                 }
-            }catch (Exception e){
+            } catch (Exception e) {
                 e.printStackTrace();
                 e.printStackTrace();
-            }finally {
+            } finally {
                 countDownLatch.countDown();
                 countDownLatch.countDown();
             }
             }
         }));
         }));
@@ -53,7 +62,7 @@ public class EtlKuaishouAccountMaterialReportDailyServiceImpl extends ServiceImp
         } catch (InterruptedException e) {
         } catch (InterruptedException e) {
             e.printStackTrace();
             e.printStackTrace();
         }
         }
-        log.info("{}数据获取完成",formatDate);
+        log.info("{}数据获取完成", formatDate);
     }
     }
 
 
     @Override
     @Override
@@ -73,4 +82,38 @@ public class EtlKuaishouAccountMaterialReportDailyServiceImpl extends ServiceImp
         etlKuaishouAccountMaterialReportDailyMapper.etlBytedanceVideoTypeZr(CtopAdConstant.VIDEO_TYPR_ZR);
         etlKuaishouAccountMaterialReportDailyMapper.etlBytedanceVideoTypeZr(CtopAdConstant.VIDEO_TYPR_ZR);
         etlKuaishouAccountMaterialReportDailyMapper.etlBytedanceVideoTypeZz(CtopAdConstant.VIDEO_TYPR_ZZ);
         etlKuaishouAccountMaterialReportDailyMapper.etlBytedanceVideoTypeZz(CtopAdConstant.VIDEO_TYPR_ZZ);
     }
     }
+
+    @Autowired
+    private IProjectService projectService;
+
+    @Override
+    public void cleanVideoInfo(Long accountId, String statDate) {
+        accountEtlExecutorService.submit(() -> {
+            log.info("开始:{},账户数据清洗",accountId);
+            JSONObject projectJson = projectService.getProjectByAccountId(accountId);
+            Long projectId = projectJson.getLong("projectId");
+            String projectName = projectJson.getString("projectName");
+            List<EtlKuaishouAccountMaterialReportDaily> reportList = dailyMaterialService.getReportList(accountId, statDate, projectId, projectName);
+            if (Check.isNull(reportList)) {
+                return;
+            }
+            List<List<EtlKuaishouAccountMaterialReportDaily>> partition = Lists.partition(reportList, 500);
+            for (int i = 0; i < partition.size(); i++) {
+                List<EtlKuaishouAccountMaterialReportDaily> addList = partition.get(i);
+                if (!Check.isNull(addList)) {
+                    etlKuaishouAccountMaterialReportDailyMapper.addBatch(addList);
+                }
+            }
+        });
+    }
+
+    @Override
+    public List<String> getDateList() {
+        return etlKuaishouAccountMaterialReportDailyMapper.getDateList();
+    }
+
+    @Override
+    public List<Long> getAccountListByDate(String date) {
+        return etlKuaishouAccountMaterialReportDailyMapper.getAccountList(date);
+    }
 }
 }

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

@@ -20,6 +20,7 @@ import cn.com.ctop.kuaishou.modules.batch.service.*;
 import cn.com.ctop.kuaishou.modules.graphql.service.IKuaishouWebInterfaceService;
 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.KuaishouAccessToken;
 import cn.com.ctop.kuaishou.modules.material.entity.KuaishouResultToken;
 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.entity.KuaiShouProjectData;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaiShouProjectData;
 import cn.com.ctop.kuaishou.modules.report.service.IKuaiShouDailyAgentService;
 import cn.com.ctop.kuaishou.modules.report.service.IKuaiShouDailyAgentService;
 import cn.com.ctop.kuaishou.modules.report.service.IKuaiShouProjectDataService;
 import cn.com.ctop.kuaishou.modules.report.service.IKuaiShouProjectDataService;
@@ -137,11 +138,25 @@ public class TestController {
     private IMaterialUploadService materialUploadService;
     private IMaterialUploadService materialUploadService;
     @Autowired
     @Autowired
     private IKuaishouProgramCreativeService kuaishouProgramCreativeService;
     private IKuaishouProgramCreativeService kuaishouProgramCreativeService;
+    @Autowired
+    private IEtlKuaishouVideoInfoService etlKuaishouVideoInfoService;
+
 
 
     @Value("${xxl-job.requestUrl}")
     @Value("${xxl-job.requestUrl}")
     private String jobUrl;
     private String jobUrl;
 
 
 
 
+    @GetMapping(value = "/cleanData")
+    public void cleanData() {
+        List<String> dateList = videoGetService.getDateList();
+        for (int i = 0; i < dateList.size(); i++) {
+            String s = dateList.get(i);
+            etlKuaishouVideoInfoService.etlKuaishouVideoInfo(s);
+        }
+
+    }
+
+
     @GetMapping(value = "/getProgramCreative")
     @GetMapping(value = "/getProgramCreative")
     public void getProgramCreative() {
     public void getProgramCreative() {
         List<Long> list = new ArrayList();
         List<Long> list = new ArrayList();
@@ -243,15 +258,6 @@ public class TestController {
         list.add(10299241L);
         list.add(10299241L);
 
 
 
 
-
-
-
-
-
-
-
-
-
         for (int i = 0; i < list.size(); i++) {
         for (int i = 0; i < list.size(); i++) {
             Long accountId = list.get(i);
             Long accountId = list.get(i);
             CtopOauthToken token = oauthTokenService.getTokenByAccountId(accountId);
             CtopOauthToken token = oauthTokenService.getTokenByAccountId(accountId);

+ 2 - 2
jeecg-cloud-module/jeecg-cloud-nacos/pom.xml

@@ -74,9 +74,9 @@
     <profiles>
     <profiles>
         <!-- 开发 -->
         <!-- 开发 -->
         <profile>
         <profile>
-            <id>dev-bak</id>
+            <id>dev</id>
             <properties>
             <properties>
-                <activatedProperties>dev-bak</activatedProperties>
+                <activatedProperties>dev</activatedProperties>
             </properties>
             </properties>
         </profile>
         </profile>
         <!-- 测试 -->
         <!-- 测试 -->

+ 2 - 2
jeecg-cloud-module/jeecg-cloud-system-start/pom.xml

@@ -96,9 +96,9 @@
     <profiles>
     <profiles>
         <!-- 开发 -->
         <!-- 开发 -->
         <profile>
         <profile>
-            <id>dev-bak</id>
+            <id>dev</id>
             <properties>
             <properties>
-                <activatedProperties>dev-bak</activatedProperties>
+                <activatedProperties>dev</activatedProperties>
             </properties>
             </properties>
         </profile>
         </profile>
         <!-- 测试 -->
         <!-- 测试 -->