Parcourir la source

Merge remote-tracking branch 'origin/test_performance' into test_performance

# Conflicts:
#	jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/IPerformanceService2.java
#	jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/PerformanceServiceImpl2.java
#	performance-appraisal/src/main/java/cn/com/ctop/userefficientvideomap/entity/UserEfficientVideoMap.java
syh il y a 5 ans
Parent
commit
ce9ccabd35
15 fichiers modifiés avec 1145 ajouts et 123 suppressions
  1. 5 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/EffiVideoJob.java
  2. 38 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/PerformanceController2.java
  3. 1 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/mapper/xml/SysRoleMapper.xml
  4. 827 94
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/PerformanceServiceImpl2.java
  5. 2 2
      performance-appraisal/src/main/java/cn/com/ctop/performanceappraisal/entity/OptimizerConfig.java
  6. 3 3
      performance-appraisal/src/main/java/cn/com/ctop/performanceappraisal/entity/Performance.java
  7. 2 2
      performance-appraisal/src/main/java/cn/com/ctop/performanceappraisal/entity/PerformanceOptimizer.java
  8. 2 2
      performance-appraisal/src/main/java/cn/com/ctop/performanceappraisal/entity/RolePerformancRraise.java
  9. 2 2
      performance-appraisal/src/main/java/cn/com/ctop/performanceappraisal/entity/RolePerformanceCommission.java
  10. 1 0
      performance-appraisal/src/main/java/cn/com/ctop/performanceappraisal/service/IPerformanceService.java
  11. 3 3
      performance-appraisal/src/main/java/cn/com/ctop/planeprojectcost/entity/PlaneProjectCost.java
  12. 1 1
      performance-appraisal/src/main/java/cn/com/ctop/userefficientvideomap/entity/SysRole.java
  13. 12 9
      performance-appraisal/src/main/java/cn/com/ctop/userefficientvideomap/entity/UserEfficientVideoMap.java
  14. 25 1
      performance-appraisal/src/main/java/cn/com/ctop/userefficientvideomap/mapper/UserEfficientVideoMapMapper.java
  15. 221 4
      performance-appraisal/src/main/java/cn/com/ctop/userefficientvideomap/mapper/xml/UserEfficientVideoMapMapper.xml

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

@@ -1,6 +1,7 @@
 package org.jeecg.modules.ctop.job;
 
 
+import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.util.DateUtils;
 import org.jeecg.modules.system.service.IPerformanceService2;
 import org.quartz.Job;
@@ -12,6 +13,7 @@ import java.text.DateFormat;
 import java.text.SimpleDateFormat;
 import java.util.Date;
 
+@Slf4j
 public class EffiVideoJob implements Job {
     @Autowired
     private IPerformanceService2 performanceService;
@@ -26,6 +28,9 @@ public class EffiVideoJob implements Job {
     public void execute(JobExecutionContext jobExecutionContext) {
         //有效视频定时任务,默认跑前一天的
         DateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+        String calcDate = sdf.format(DateUtils.addDay(new Date(), -1));
+        log.info("有效视频定时任务开始执行,有效视频所属时间为" + calcDate);
         performanceService.efficientVideoTask(sdf.format(DateUtils.addDay(new Date(), -1)));
+        log.info("有效视频定时任务结束");
     }
 }

+ 38 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/PerformanceController2.java

@@ -4,6 +4,7 @@ import cn.com.ctop.userefficientvideomap.entity.DesignMaterialInfo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang.StringUtils;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.modules.system.service.IPerformanceService2;
@@ -106,4 +107,41 @@ public class PerformanceController2 {
         return result;
     }
 
+    @AutoLog(value = "根据year、quarter计算季度设计师绩效")
+    @ApiOperation(value = "根据year、quarter计算季度设计师绩效", notes = "根据year、quarter计算季度设计师绩效")
+    @PostMapping(value = "/designerPerformance")
+    public Result<Map<String,Object>> designerPerformanceTask(@RequestParam(name = "year", required = true) int year,
+                                                              @RequestParam(name = "quarter", required = true) int quarter) {
+        Result<Map<String,Object>> result = new Result<Map<String,Object>>();
+        try {
+            performanceService.designerPerformanceTask(1,2);
+            result.setSuccess(true);
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            log.error("/ctop/performance2/designerPerformance出错啦" + "year:" + year + " quarter:" + quarter);
+            result.error500("/ctop/performance2/designerPerformance出错啦");
+        }
+        return result;
+    }
+
+    @AutoLog(value = "有效视频定时任务")
+    @ApiOperation(value = "有效视频定时任务", notes = "calcDate传递yyyy-MM-dd格式的日期")
+    @PostMapping(value = "/efficientVideo")
+    public Result<Map<String,Object>> efficientVideo(@RequestParam(name = "calcDate", required = true) String calcDate) {
+        log.info("有效视频任务开始,有效视频所属时间为" + calcDate);
+        Result<Map<String,Object>> result = new Result<Map<String,Object>>();
+        if (StringUtils.isBlank(calcDate)){
+            result.error500("时间不能为空");
+        }
+        try {
+            performanceService.efficientVideoTask(calcDate);
+            result.setSuccess(true);
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            log.error("/ctop/performance2/efficientVideo出错啦" + "date:" + calcDate );
+            result.error500("/ctop/performance2/efficientVideo出错啦");
+        }
+        return result;
+    }
+
 }

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

@@ -13,6 +13,7 @@
 		sys_user a
 		left join sys_user_role b on a.id = b.user_id
 		left join sys_role c on b.role_id = c.id
+		left join sys_
         where
         c.role_code = #{roleCode}
 	</select>

Fichier diff supprimé car celui-ci est trop grand
+ 827 - 94
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/PerformanceServiceImpl2.java


+ 2 - 2
performance-appraisal/src/main/java/cn/com/ctop/performanceappraisal/entity/OptimizerConfig.java

@@ -35,8 +35,8 @@ public class OptimizerConfig {
     /**
      * 媒体类型
      */
-    @Excel(name = "媒体类型", width = 15)
-    @ApiModelProperty(value = "媒体类型")
+    @Excel(name = "媒体类型1_头条2_快手", width = 15)
+    @ApiModelProperty(value = "媒体类型1_头条2_快手")
     private Integer appType;
     /**
      * 媒体任务

+ 3 - 3
performance-appraisal/src/main/java/cn/com/ctop/performanceappraisal/entity/Performance.java

@@ -104,9 +104,9 @@ public class Performance {
     /**
      * 1_快手2_抖音
      */
-    @Excel(name = "媒体类型", width = 15)
-    @ApiModelProperty(value = "媒体类型")
-    @Dict(dicCode = "media_type")
+    @Excel(name = "媒体类型1_头条2_快手", width = 15)
+    @ApiModelProperty(value = "媒体类型1_头条2_快手")
+    @Dict(dicCode = "app_type")
     private Integer appType;
     /**
      * 创建时间

+ 2 - 2
performance-appraisal/src/main/java/cn/com/ctop/performanceappraisal/entity/PerformanceOptimizer.java

@@ -72,8 +72,8 @@ public class PerformanceOptimizer {
     /**
      * 媒体类型
      */
-    @Excel(name = "媒体类型", width = 15)
-    @ApiModelProperty(value = "媒体类型")
+    @Excel(name = "媒体类型1_头条2_快手", width = 15)
+    @ApiModelProperty(value = "媒体类型1_头条2_快手")
     private Integer appType;
     /**
      * createTime

+ 2 - 2
performance-appraisal/src/main/java/cn/com/ctop/performanceappraisal/entity/RolePerformancRraise.java

@@ -61,8 +61,8 @@ public class RolePerformancRraise {
     /**
      * 1:快手 2:头条
      */
-    @Excel(name = "媒体类型", width = 15)
-    @ApiModelProperty(value = "媒体类型")
+    @Excel(name = "媒体类型1_头条2_快手", width = 15)
+    @ApiModelProperty(value = "媒体类型1_头条2_快手")
     @Dict(dicCode = "media_type")
     private Integer appType;
     /**

+ 2 - 2
performance-appraisal/src/main/java/cn/com/ctop/performanceappraisal/entity/RolePerformanceCommission.java

@@ -56,8 +56,8 @@ public class RolePerformanceCommission {
     /**
      * 1:快手  2:头条
      */
-    @Excel(name = "媒体类型", width = 15)
-    @ApiModelProperty(value = "媒体类型")
+    @Excel(name = "媒体类型1_头条2_快手", width = 15)
+    @ApiModelProperty(value = "媒体类型1_头条2_快手")
     @Dict(dicCode = "media_type")
     private Integer appType;
 

+ 1 - 0
performance-appraisal/src/main/java/cn/com/ctop/performanceappraisal/service/IPerformanceService.java

@@ -34,4 +34,5 @@ public interface IPerformanceService extends IService<Performance> {
     Map<String, Object> getUserOptimizerAccountList(String apptype, Long projectId, Integer pageNo, Integer pageSize);
 
     Map<String, Object> getMemberPerformanceByUserId(OptimizerConfig config, OptimizerCostDetailVO totalCostVo);
+
 }

+ 3 - 3
performance-appraisal/src/main/java/cn/com/ctop/planeprojectcost/entity/PlaneProjectCost.java

@@ -44,9 +44,9 @@ public class PlaneProjectCost {
 	@Excel(name = "项目消耗", width = 15)
     @ApiModelProperty(value = "项目消耗")
 	private java.math.BigDecimal projectCost;
-	/**1_快手2_抖音*/
-	@Excel(name = "1_快手2_抖音", width = 15)
-    @ApiModelProperty(value = "1_快手2_抖音")
+	/**1_头条2_快手*/
+	@Excel(name = "1_头条2_快手", width = 15)
+    @ApiModelProperty(value = "1_头条2_快手")
 	private Integer appType;
 	/**项目总消耗*/
 	@Excel(name = "项目总消耗", width = 15)

+ 1 - 1
performance-appraisal/src/main/java/cn/com/ctop/userefficientvideomap/entity/SysRole.java

@@ -46,7 +46,7 @@ public class SysRole implements Serializable {
     private String roleCode;
 
     /**
-          * 描述
+     * 描述
      */
     @Excel(name="描述",width=60)
     private String description;

+ 12 - 9
performance-appraisal/src/main/java/cn/com/ctop/userefficientvideomap/entity/UserEfficientVideoMap.java

@@ -1,17 +1,20 @@
 package cn.com.ctop.userefficientvideomap.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;
 
-import java.util.Date;
-
 /**
  * 有效视频与角色对应表
  * @author jeecg-boot
@@ -26,9 +29,9 @@ import java.util.Date;
 public class UserEfficientVideoMap {
 
 	/**id*/
-    @TableId(type = IdType.AUTO)
+	@TableId(type = IdType.AUTO)
     @ApiModelProperty(value = "id")
-    private Long id;
+	private Long id;
 	/**有效视频md5*/
 	@Excel(name = "有效视频md5", width = 15)
     @ApiModelProperty(value = "有效视频md5")
@@ -49,17 +52,17 @@ public class UserEfficientVideoMap {
 	@Excel(name = "年", width = 15)
     @ApiModelProperty(value = "年")
 	private Integer year;
-	/***/
+	/***/
 	@Excel(name = "月", width = 15)
 	@ApiModelProperty(value = "月")
 	private Integer month;
-	/**计算日期_按照此日期进行所属年月季度的计算的*/
+	/**计算日期_用于计算所属年月季的基础日期*/
 	@Excel(name = "计算日期", width = 15)
 	@ApiModelProperty(value = "计算日期")
 	private Date calcDate;
-	/**媒体类型1_快手2_头条*/
-	@Excel(name = "媒体类型1_快手2_头条", width = 15)
-    @ApiModelProperty(value = "媒体类型1_快手2_头条")
+	/**媒体类型1_头条2_快手*/
+	@Excel(name = "媒体类型1_头条2_快手", width = 15)
+    @ApiModelProperty(value = "媒体类型1_头条2_快手")
 	private Integer appType;
 	/**createTime*/
     @ApiModelProperty(value = "createTime")

+ 25 - 1
performance-appraisal/src/main/java/cn/com/ctop/userefficientvideomap/mapper/UserEfficientVideoMapMapper.java

@@ -21,7 +21,7 @@ public interface UserEfficientVideoMapMapper extends BaseMapper<UserEfficientVid
 
     int getEffiVideoCountBySignature(@Param("signature")String signature, @Param("appType")Integer appType);
 
-    int getEffiVideoCountByUserId(@Param("year")int year, @Param("quarter")int quarter, @Param("userId")String userId);
+    int getEffiVideoCountByUserId(@Param("appType")int appType, @Param("year")int year, @Param("quarter")int quarter, @Param("userId")String userId);
 
     int getQuarterMaterialCountByUserId(@Param("roleCode")String roleCode, @Param("startTime")String startTime, @Param("endTime")String endTime, @Param("userId")String userId);
 
@@ -53,8 +53,32 @@ public interface UserEfficientVideoMapMapper extends BaseMapper<UserEfficientVid
 
     List<UserDto2> getKuaishouDesignLeaderList();
 
+    List<UserDto2> getKuaishouPlanList();
+
+    List<UserDto2> getKuaishouShotList();
+
+    List<UserDto2> getKuaishouClipList();
+
+    List<UserDto2> getToutiaoPlanList();
+
+    List<UserDto2> getToutiaoShotList();
+
+    List<UserDto2> getToutiaoClipList();
+
+    List<UserDto2> getToutiaoDesignLeaderList();
+
     List<String> getClip(@Param("depId")String depId);
 
     BigDecimal getClipQuarterCost(@Param("appType")Integer appType, @Param("quarter")int quarter, @Param("year")int year, @Param("userId")String userId);
+
+    //头条有效视频计算sql
+    List<EffiVideoDTO> getToutiaoUserVideoMap(@Param("startDate")String startDate, @Param("endDate")String endDate, @Param("startCalcDate")String startCalcDate, @Param("endCalcDate")String endCalcDate);
+
+    BigDecimal toutiaoGetTotalCostByClipId(@Param("userId")String userId, @Param("startDate")String startDate, @Param("endDate")String endDate);
+
+    BigDecimal toutiaoGetTotalCostByShotId(@Param("userId")String userId, @Param("startDate")String startDate, @Param("endDate")String endDate);
+
+    BigDecimal toutiaoGetTotalCostByPlanId(@Param("userId")String userId, @Param("startDate")String startDate, @Param("endDate")String endDate);
+
 }
 

+ 221 - 4
performance-appraisal/src/main/java/cn/com/ctop/userefficientvideomap/mapper/xml/UserEfficientVideoMapMapper.xml

@@ -49,6 +49,7 @@
         where year = #{year}
         and quarter = #{quarter}
         and user_id = #{userId}
+        and app_type = #{appType}
     </select>
 
     <!-- 按人获取季度总视频数量 -->
@@ -71,7 +72,6 @@
                 b.shot_id = #{userId}
             </otherwise>
         </choose>
-
     </select>
 
     <!-- 根据clip_id获取视频总消耗 -->
@@ -91,7 +91,7 @@
         and c.clip_id = #{userId}
     </select>
 
-    <!-- 根据clip_id获取视频总消耗 -->
+    <!-- 根据shot_id获取视频总消耗 -->
     <select id="getTotalCostByShotId" resultType="java.math.BigDecimal">
             select
             sum(a.charge) as charge
@@ -108,7 +108,7 @@
         and c.shot_id = #{userId}
     </select>
 
-    <!-- 根据clip_id获取视频总消耗 -->
+    <!-- 根据plan_id获取视频总消耗 -->
     <select id="getTotalCostByPlanId" resultType="java.math.BigDecimal">
             select
             sum(a.charge) as charge
@@ -170,7 +170,6 @@
         user_id = #{userId}
     </select>
 
-
     <!-- 根据项目id获取平面设计师的数量 -->
     <select id="getPlaneCountByProjectId" resultType="java.lang.Integer">
         select
@@ -299,6 +298,66 @@
         and b.parent_id = '4e939124a5f541c88838e49d2a3ea72b'  <!-- 快手设计部 -->
     </select>
 
+    <!-- 获取快手编导列表 -->
+    <select id="getKuaishouPlanList" resultType="cn.com.ctop.userefficientvideomap.entity.UserDto2">
+            select
+            a.user_id as userId,
+            c.realname as userName,
+            '0214283aa16f943efbb149ea4bb18f18' as roleId,
+            '策划' as roleName,
+            a.dep_id as depId
+        FROM sys_user_depart a
+        left join sys_user c on a.user_id = c.id
+        left join sys_depart b on a.dep_id = b.id
+                    WHERE a.user_id in(
+                        select
+                        user_id
+                        from sys_user_role
+                        WHERE role_id = '0214283aa16f943efbb149ea4bb18f18'    <!-- 编导 -->
+                        )
+        and b.parent_id = '4e939124a5f541c88838e49d2a3ea72b'  <!-- 快手设计部 -->
+    </select>
+
+    <!-- 获取快手拍摄列表 -->
+    <select id="getKuaishouShotList" resultType="cn.com.ctop.userefficientvideomap.entity.UserDto2">
+            select
+            a.user_id as userId,
+            c.realname as userName,
+            '7bff9afed625aeeabca6bffe3c189183' as roleId,
+            '拍摄' as roleName,
+            a.dep_id as depId
+        FROM sys_user_depart a
+        left join sys_user c on a.user_id = c.id
+        left join sys_depart b on a.dep_id = b.id
+                    WHERE a.user_id in(
+                        select
+                        user_id
+                        from sys_user_role
+                        WHERE role_id = '7bff9afed625aeeabca6bffe3c189183'   <!-- 拍摄 -->
+                        )
+        and b.parent_id = '4e939124a5f541c88838e49d2a3ea72b'   <!-- 快手设计部 -->
+    </select>
+
+    <!-- 获取快手剪辑列表 -->
+    <select id="getKuaishouClipList" resultType="cn.com.ctop.userefficientvideomap.entity.UserDto2">
+        select
+        a.user_id as userId,
+        c.realname as userName,
+        'f38d8d70cf7ec50d5357a749e4dbf8ee' as roleId,
+        '剪辑' as roleName,
+        a.dep_id as depId
+        FROM sys_user_depart a
+        left join sys_user c on a.user_id = c.id
+        left join sys_depart b on a.dep_id = b.id
+        WHERE a.user_id in(
+        select
+        user_id
+        from sys_user_role
+        WHERE role_id = 'f38d8d70cf7ec50d5357a749e4dbf8ee'   <!-- 拍摄 -->
+        )
+        and b.parent_id = '4e939124a5f541c88838e49d2a3ea72b'   <!-- 快手设计部 -->
+    </select>
+
     <!-- 根据部门id -->
     <select id="getClip" resultType="string">
         select
@@ -322,4 +381,162 @@
         and user_id = #{userId}
     </select>
 
+    <!-- 获取toutiao设计师leader的信息 -->
+    <select id="getToutiaoDesignLeaderList" resultType="cn.com.ctop.userefficientvideomap.entity.UserDto2">
+        select
+        a.user_id as userId,
+        c.realname as userName,
+        '8d3e2ed58bdedf17716f698ea674da27' as roleId,
+        '设计组长' as roleName,
+        a.dep_id as depId
+        FROM sys_user_depart a
+        left join sys_user c on a.user_id = c.id
+        left join sys_depart b on a.dep_id = b.id
+        WHERE a.user_id in(
+        select
+        user_id
+        from sys_user_role
+        WHERE role_id = '8d3e2ed58bdedf17716f698ea674da27'   <!-- 设计师 -->
+        )
+        and b.parent_id = '26c10ecb5e0d416bb01f8ff983f4588c'  <!-- 快手设计部 -->
+    </select>
+
+    <!-- 获取toutiao编导列表 -->
+    <select id="getToutiaoPlanList" resultType="cn.com.ctop.userefficientvideomap.entity.UserDto2">
+        select
+        a.user_id as userId,
+        c.realname as userName,
+        '0214283aa16f943efbb149ea4bb18f18' as roleId,
+        '策划' as roleName,
+        a.dep_id as depId
+        FROM sys_user_depart a
+        left join sys_user c on a.user_id = c.id
+        left join sys_depart b on a.dep_id = b.id
+        WHERE a.user_id in(
+        select
+        user_id
+        from sys_user_role
+        WHERE role_id = '0214283aa16f943efbb149ea4bb18f18'    <!-- 编导 -->
+        )
+        and b.parent_id = '26c10ecb5e0d416bb01f8ff983f4588c'  <!-- 快手设计部 -->
+    </select>
+
+    <!-- 获取toutiao拍摄列表 -->
+    <select id="getToutiaoShotList" resultType="cn.com.ctop.userefficientvideomap.entity.UserDto2">
+        select
+        a.user_id as userId,
+        c.realname as userName,
+        '7bff9afed625aeeabca6bffe3c189183' as roleId,
+        '拍摄' as roleName,
+        a.dep_id as depId
+        FROM sys_user_depart a
+        left join sys_user c on a.user_id = c.id
+        left join sys_depart b on a.dep_id = b.id
+        WHERE a.user_id in(
+        select
+        user_id
+        from sys_user_role
+        WHERE role_id = '7bff9afed625aeeabca6bffe3c189183'   <!-- 拍摄 -->
+        )
+        and b.parent_id = '26c10ecb5e0d416bb01f8ff983f4588c'   <!-- 快手设计部 -->
+    </select>
+
+    <!-- 获取toutiao剪辑列表 -->
+    <select id="getToutiaoClipList" resultType="cn.com.ctop.userefficientvideomap.entity.UserDto2">
+        select
+        a.user_id as userId,
+        c.realname as userName,
+        'f38d8d70cf7ec50d5357a749e4dbf8ee' as roleId,
+        '剪辑' as roleName,
+        a.dep_id as depId
+        FROM sys_user_depart a
+        left join sys_user c on a.user_id = c.id
+        left join sys_depart b on a.dep_id = b.id
+        WHERE a.user_id in(
+        select
+        user_id
+        from sys_user_role
+        WHERE role_id = 'f38d8d70cf7ec50d5357a749e4dbf8ee'   <!-- 拍摄 -->
+        )
+        and b.parent_id = '26c10ecb5e0d416bb01f8ff983f4588c'   <!-- 快手设计部 -->
+    </select>
+
+    <!-- 头条有效视频用户关系绑定 -->
+    <select id="getToutiaoUserVideoMap" resultType="cn.com.ctop.userefficientvideomap.entity.EffiVideoDTO">
+            select
+            c.signature as signature,
+            sum(a.cost) as charge, <!-- 总花费 -->
+            f1.id as clipId,
+            f1.realname as clipName,
+            f2.id as shotId,
+            f2.realname as shotName,
+            f3.id as planId,
+            f3.realname as planName,
+            f4.id as planeId,
+            f4.realname as planeName
+        from
+        ctop_bytedance_report_creative_daily a
+        left join ctop_bytedance_creative b on a.creative_id = b.id
+        left join ctop_bytedance_video_info c on b.video_id = c.id
+        left join ctop_material_info d on c.signature = d.code
+        left join ctop_material_ascription e on on d.id = e.material_id
+        left join sys_user f1 on e.clip_id = f1.id
+        left join sys_user f2 on e.shot_id = f2.id
+        left join sys_user f3 on e.plan_id = f3.id
+        left join sys_user f4 on e.plane_id = f4.id
+        where
+        c.signature is not null and d.id is not null and
+        date_format(a.stat_datetime, '%Y-%m-%d') &gt;= #{startTime} and
+        date_format(a.stat_datetime, '%Y-%m-%d') &lt;= #{endTime} and
+        date_format(d.create_time, '%Y-%m-%d') &gt;= #{startDate} and
+        date_format(d.update_time, '%Y-%m-%d') &lt;= #{endDate}
+        group by c.signature
+        having sum(a.charge) >= 5000
+    </select>
+
+    <!-- 头条根据plan_id获取视频总消耗 -->
+    <select id="toutiaoGetTotalCostByPlanId" resultType="java.math.BigDecimal">
+            select
+            sum(a.charge) as charge
+            ctop_bytedance_report_creative_daily a
+        left join ctop_bytedance_creative b on a.creative_id = b.id
+        left join ctop_bytedance_video_info c on b.video_id = c.id
+        left join ctop_material_info d on c.signature = d.code
+        left join ctop_material_ascription e on on d.id = e.material_id
+        where c.signature is not null and d.id is not null
+        and DATE_FORMAT(d.create_time,'%Y-%m-%d') &gt;= #{startDate}
+        and DATE_FORMAT(d.create_time,'%Y-%m-%d') &lt;= #{endDate}
+        where e.plan_id = #{userId}
+    </select>
+
+    <!-- 头条根据clip_id获取视频总消耗 -->
+    <select id="toutiaoGetTotalCostByClipId" resultType="java.math.BigDecimal">
+            select
+            sum(a.charge) as charge
+            ctop_bytedance_report_creative_daily a
+        left join ctop_bytedance_creative b on a.creative_id = b.id
+        left join ctop_bytedance_video_info c on b.video_id = c.id
+        left join ctop_material_info d on c.signature = d.code
+        left join ctop_material_ascription e on on d.id = e.material_id
+        where c.signature is not null and d.id is not null
+        and DATE_FORMAT(d.create_time,'%Y-%m-%d') &gt;= #{startDate}
+        and DATE_FORMAT(d.create_time,'%Y-%m-%d') &lt;= #{endDate}
+        where e.clip_id = #{userId}
+    </select>
+
+    <!-- 头条根据shot_id获取视频总消耗 -->
+    <select id="toutiaoGetTotalCostByShotId" resultType="java.math.BigDecimal">
+            select
+            sum(a.charge) as charge
+            ctop_bytedance_report_creative_daily a
+        left join ctop_bytedance_creative b on a.creative_id = b.id
+        left join ctop_bytedance_video_info c on b.video_id = c.id
+        left join ctop_material_info d on c.signature = d.code
+        left join ctop_material_ascription e on on d.id = e.material_id
+        where c.signature is not null and d.id is not null
+        and DATE_FORMAT(d.create_time,'%Y-%m-%d') &gt;= #{startDate}
+        and DATE_FORMAT(d.create_time,'%Y-%m-%d') &lt;= #{endDate}
+        where e.shot_id = #{userId}
+    </select>
+
 </mapper>