Sfoglia il codice sorgente

绩效周报接口调整

hcst_sunzhen 5 anni fa
parent
commit
4da517e11b

+ 13 - 9
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/PerformanceServiceImpl2.java

@@ -98,12 +98,12 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
         log.info("统计时间所在年" + thisYear + "月" + thisMonth + "季" + thisQuarter);
 
         //快手有效视频(新)
-        //kuaishouNewEffiVideo(calcDate, effiCalcStart, effiFirstWeekCalcEnd, thisYear, thisMonth, thisQuarter, DateUtils.formatDate(friday), DateUtils.formatDate(thursday));
+        kuaishouNewEffiVideo(calcDate, effiCalcStart, effiFirstWeekCalcEnd, thisYear, thisMonth, thisQuarter, DateUtils.formatDate(friday), DateUtils.formatDate(thursday));
         //头条有效视频
         //toutiaoNewEffiVideo(calcDate, effiCalcStart, effiFirstWeekCalcEnd, thisYear, thisMonth, thisQuarter, DateUtils.formatDate(friday), DateUtils.formatDate(thursday));
 
         //总视频
-        kuaishouNewVideo( calcDate,  thisYear,  thisQuarter,  thisMonth, DateUtils.formatDate(friday),  DateUtils.formatDate(thursday));
+        //kuaishouNewVideo( calcDate,  thisYear,  thisQuarter,  thisMonth, DateUtils.formatDate(friday),  DateUtils.formatDate(thursday));
     }
 
     //快手有效视频统计
@@ -2188,7 +2188,7 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
         //2 循环所有人,并查询出每个人的有效视频数、总视频数、总消耗
         for (UserDto2 userDto : userDto2List) {
             //2.1 获取有效视频数量
-            Integer effiVideoCount = userEfficientVideoMapMapper.getEffiVideoCountByCalcDate(startDate, endDate, userDto.getRoleId(), userDto.getUserId(), 2);
+            Integer effiVideoCount = userEfficientVideoMapMapper.getEffiVideoCountByCalcDate(startDate, endDate, userDto.getUserId(), 2);
             //2.2 获取视频总数
             Integer videoCount = userEfficientVideoMapMapper.getVideoCountByUserId(userDto.getUserId(), startDate, endDate);
             //2.3 总消耗
@@ -2218,16 +2218,20 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
         for (UserDto2 userDto : userDto2List) {
             String roleCode = userDto.getRoleCode();
             //2.1 获取有效视频数量
-            Integer effiVideoCount = userEfficientVideoMapMapper.getEffiVideoCountByCalcDate(startDate, endDate, userDto.getRoleId(), userDto.getUserId(), 1);
+            Integer effiVideoCount = userEfficientVideoMapMapper.getEffiVideoCountByCalcDate(startDate, endDate, userDto.getUserId(), 1);
             //2.2 获取视频总数
             Integer videoCount = userEfficientVideoMapMapper.getVideoCountByUserId(userDto.getUserId(), startDate, endDate);
             //2.3 总消耗
-            BigDecimal cost = userEfficientVideoMapMapper.getTotalCostByUserId(userDto.getUserId(), startDate, endDate);
-
-            if(cost == null){
-                cost = BigDecimal.ZERO;
+            BigDecimal totalCost = BigDecimal.ZERO;
+            List<String> md5s = userEfficientVideoMapMapper.getTotalSignatureByUserId(userDto.getUserId(), startDate, endDate);
+            for(String md5:md5s){
+                BigDecimal cost = userEfficientVideoMapMapper.getToutiaoSumChargeBySignature(md5, startDate, endDate);
+                if(cost== null){
+                    cost = BigDecimal.ZERO;
+                }
+                totalCost = totalCost.add(cost);
             }
-            userDto.setCost(cost);
+            userDto.setCost(totalCost);
             userDto.setVideoCount(videoCount);
             userDto.setEffiVideoCount(effiVideoCount);
         }

+ 5 - 0
module-common/src/main/java/cn/com/ctop/common/module/entity/MaterialInfo.java

@@ -136,4 +136,9 @@ public class MaterialInfo {
     @TableField(exist = false)
     private JSONObject kuaiShou;
 
+    @TableField(exist = false)
+    private String videoRoleCode;  //拍摄时候担任的角色
+
+    @TableField(exist = false)
+    private String originRoleName;  //原本的角色
 }

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

@@ -120,7 +120,7 @@ public interface UserEfficientVideoMapMapper extends BaseMapper<UserEfficientVid
     List<UserDto2> getToutiaoDepartAllUserInfo();
 
     //根据天数的区间获取userId获取有效视频数量
-    Integer getEffiVideoCountByCalcDate(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("roleId") String roleId, @Param("userId") String userId, @Param("appType") Integer appType);
+    Integer getEffiVideoCountByCalcDate(@Param("startDate") String startDate, @Param("endDate") String endDate,  @Param("userId") String userId, @Param("appType") Integer appType);
 
     List<MaterialInfo> getEffiVideoList(@Param("appType") Integer appType, @Param("year") Integer year, @Param("quarter") Integer quarter, @Param("userId") String userId);
 
@@ -170,6 +170,8 @@ public interface UserEfficientVideoMapMapper extends BaseMapper<UserEfficientVid
 
     BigDecimal getSumChargeBySignature(@Param("signature")String signature, @Param("startDate")String startDate, @Param("endDate")String endDate);
 
+    BigDecimal getToutiaoSumChargeBySignature(@Param("signature")String signature, @Param("startDate")String startDate, @Param("endDate")String endDate);
+
     List<MaterialInfo> getVideoList(@Param("userId")String userId, @Param("startDate")String startDate, @Param("endDate")String endDate);
 }
 

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

@@ -134,6 +134,18 @@
         group by video_signature
     </select>
 
+    <select id="getToutiaoSumChargeBySignature" resultType="java.math.BigDecimal">
+        select
+            sum(a.cost) as charge
+        from
+        ctop_bytedance_report_creative_daily a
+        where a.signature = #{signature}
+        and
+        DATE_FORMAT(a.stat_datetime,'%Y-%m-%d') &gt;= #{startDate}
+        and
+        DATE_FORMAT(a.stat_datetime,'%Y-%m-%d') &lt;= #{endDate}
+    </select>
+
     <select id="getSumChargeBySignature" resultType="java.math.BigDecimal">
         select
             sum(a.charge) as charge
@@ -146,6 +158,7 @@
         DATE_FORMAT(a.stat_date,'%Y-%m-%d') &lt;= #{endDate}
     </select>
 
+
     <!-- 根据shot_id获取视频总消耗 -->
     <select id="getTotalCostByShotId" resultType="java.math.BigDecimal">
             select
@@ -951,7 +964,7 @@
         from
         ctop_user_efficient_video_map
         where user_id = #{userId}
-        and role_id = #{roleId}
+       <!-- and role_id = #{roleId}  -->
         and app_type = #{appType}
         and calc_date &lt;= #{endDate}
         and calc_date &gt;= #{startDate}
@@ -964,10 +977,14 @@
             i.code as code,
             i.url as url,
             i.material_name as materialName,
-            i.watermark_material_name as watermarkMaterialName
+            i.watermark_material_name as watermarkMaterialName,
+            m.role_id as videoRoleCode,  <!-- 拍摄时候担任的角色 -->
+            r.role_name as originRoleName  <!-- 原本的角色 -->
         from
         ctop_user_efficient_video_map m
-        left join ctop_material_info i on m.efficient_video_signature = i.code
+        left join (select id,code,url,material_name,watermark_material_name from ctop_material_info group by code) i on m.efficient_video_signature = i.code
+        left join sys_user_role sr on m.user_id = sr.user_id
+        left join sys_role r on sr.role_id = r.id
         where
         m.user_id = #{userId} and
         m.app_type =#{appType} and
@@ -982,10 +999,14 @@
             i.code as code,
             i.url as url,
             i.material_name as materialName,
-            i.watermark_material_name as watermarkMaterialName
+            i.watermark_material_name as watermarkMaterialName,
+            m.role_id as videoRoleCode,  <!-- 拍摄时候担任的角色 -->
+            r.role_name as originRoleName  <!-- 原本的角色 -->
         from
         ctop_user_efficient_video_map m
         left join (select id,code,url,material_name,watermark_material_name from ctop_material_info group by code) i on m.efficient_video_signature = i.code
+        left join sys_user_role sr on m.user_id = sr.user_id
+        left join sys_role r on sr.role_id = r.id
         where
         m.user_id = #{userId} and
         m.app_type =#{appType} and
@@ -1143,10 +1164,19 @@
             i.code as code,
             i.url as url,
             i.material_name as materialName,
-            i.watermark_material_name as watermarkMaterialName
+            i.watermark_material_name as watermarkMaterialName,
+            m.role_id as videoRoleCode,  <!-- 拍摄时候担任的角色 -->
+            r.role_name as originRoleName  <!-- 原本的角色 -->
         from
         ctop_user_video_map m
-        left join ctop_material_info i on m.video_signature = i.code
+        left join (
+                    select
+                    id,code,url,material_name,watermark_material_name
+                    from
+                    ctop_material_info group by code
+                    ) i on m.video_signature = i.code
+        left join sys_user_role sr on m.user_id = sr.user_id
+        left join sys_role r on sr.role_id = r.id
         where
         m.user_id = #{userId} and
         m.calc_date &gt;= #{startDate} and