瀏覽代碼

头条绩效提交

hcst_sunzhen 5 年之前
父節點
當前提交
ba394d3b73

+ 17 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/PerformanceController2.java

@@ -1,6 +1,5 @@
 package org.jeecg.modules.system.controller;
 
-import cn.com.ctop.crawler.modules.account.entity.KuaishouAppAccount;
 import cn.com.ctop.userefficientvideomap.entity.DesignMaterialInfo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -104,4 +103,21 @@ 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;
+    }
+
 }

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

+ 2 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/IPerformanceService2.java

@@ -28,4 +28,6 @@ public interface IPerformanceService2 extends IService<Performance> {
 
     //点击+符号 投放账户、投放账户、跑量
     public List<DesignMaterialInfo> materialAccountInfo(String materialInfoId);
+
+    void designerPerformanceTask(int year, int quarter);
 }

File diff suppressed because it is too large
+ 874 - 417
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/PerformanceServiceImpl2.java


+ 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(Long projectId, Integer pageNo, Integer pageSize);
 
     Map<String, Object> getMemberPerformanceByUserId(OptimizerConfig config, OptimizerCostDetailVO totalCostVo);
+
 }

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