Selaa lähdekoodia

平面、设计师leader绩效逻辑修改、绩效项目维度接口增加

hcst_sunzhen 5 vuotta sitten
vanhempi
commit
f0731e8c35

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

@@ -147,6 +147,13 @@ public class PerformanceController2 {
             result.error500("时间不能为空");
         }
         try {
+            //String calc = "2020-01-03";
+            //for(int i=0; i<12 ;i++){
+            //    if(i!=0){
+            //        calc = DateUtils.addDay( calc,  7);
+            //    }
+            //    performanceService.efficientVideoTask(calc);
+            //}
             performanceService.efficientVideoTask(calcDate);
             result.setSuccess(true);
         } catch (Exception e) {
@@ -713,5 +720,42 @@ public class PerformanceController2 {
         return result;
     }
 
+    @AutoLog(value = "项目报表-根据accountId获取季度视频信息")
+    @ApiOperation(value = "根据accountId获取季度视频信息", notes = "根据accountId获取季度视频信息")
+    @PostMapping(value = "/getUserQuarterVideo")
+    public Result<List<VideoDTO>> getUserQuarterVideo(@RequestBody PerformanceTimeDTO dto,
+                                                                        HttpServletRequest req) {
+        Result<List<VideoDTO>> result = new Result<>();
+        Integer year = dto.getYear();
+        Integer quarter = dto.getQuarter();
+        String userId = dto.getUserId();
+        if(year==null || quarter == null || userId == null ){
+            result.setSuccess(false);
+            result.setMessage("媒体类型均不能为空");
+        }
+        List<VideoDTO> userDto2List = performanceService.getUserQuarterVideo(year, quarter, userId);
+        result.setSuccess(true);
+        result.setResult(userDto2List);
+        return result;
+    }
+
+    @AutoLog(value = "项目报表-根据userId获取有效视频信息")
+    @ApiOperation(value = "根据userId获取有效视频信息", notes = "根据userId获取有效视频信息")
+    @PostMapping(value = "/getUserQuarterEffiVideo")
+    public Result<List<VideoDTO>> getUserQuarterEffiVideo(@RequestBody PerformanceTimeDTO dto,
+                                                      HttpServletRequest req) {
+        Result<List<VideoDTO>> result = new Result<>();
+        Integer year = dto.getYear();
+        Integer quarter = dto.getQuarter();
+        String userId = dto.getUserId();
+        if(year==null || quarter == null || userId == null ){
+            result.setSuccess(false);
+            result.setMessage("媒体类型均不能为空");
+        }
+        List<VideoDTO> userDto2List = performanceService.getUserQuarterEffiVideo(year, quarter, userId);
+        result.setSuccess(true);
+        result.setResult(userDto2List);
+        return result;
+    }
 
 }

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

@@ -132,4 +132,8 @@ public interface IPerformanceService2 extends IService<Performance> {
 
     //根据accountId获取季度视频信息
     List<VideoDTO> getToutiaoQuarterVideoInfoByAccountId(Integer year, Integer quarter, Long accountId);
+
+    List<VideoDTO> getUserQuarterVideo(Integer year, Integer quarter, String userId);
+
+    List<VideoDTO> getUserQuarterEffiVideo(Integer year, Integer quarter, String userId);
 }

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

@@ -99,162 +99,16 @@ 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));
+        toutiaoNewEffiVideo(calcDate, effiCalcStart, effiFirstWeekCalcEnd, thisYear, thisMonth, thisQuarter, DateUtils.formatDate(friday), DateUtils.formatDate(thursday));
 
         //快手总视频
-        //newKuaishouVideo( calcDate,  thisYear,  thisQuarter,  thisMonth, DateUtils.formatDate(friday),  DateUtils.formatDate(thursday));
+        newKuaishouVideo( calcDate,  thisYear,  thisQuarter,  thisMonth, DateUtils.formatDate(friday),  DateUtils.formatDate(thursday));
         //头条总视频
         newToutiaoVideo( calcDate,  thisYear,  thisQuarter,  thisMonth, DateUtils.formatDate(friday),  DateUtils.formatDate(thursday));
     }
 
-    //快手有效视频统计--旧版已废弃
-    //private void kuaishouEffiVideo(Date calcDate, String effiCalcStart, String effiCalcEnd, String effiStart, String effiEnd, int thisYear, int thisMonth, int thisQuarter) {
-    //    log.info("快手有效视频统计开始,统计时间为 " + calcDate);
-    //    //获取时间段内所有<快手>的有效视频
-    //    List<EffiVideoDTO> EffiVideoDTOList = userEfficientVideoMapMapper.getUserVideoMap(effiStart, effiEnd, effiCalcStart, effiCalcEnd);
-    //
-    //    for (EffiVideoDTO effiVideoDTO : EffiVideoDTOList) {
-    //        //判断此视频是否已经在关系表中存在,如果已经存在则说明此视频已经存在,跳过即可
-    //        //有效视频的逻辑是无论是快手还是头条
-    //        int signatureCount = userEfficientVideoMapMapper.getEffiVideoCountBySignature(effiVideoDTO.getSignature(), new Integer(2));//1快手 2头条
-    //        if (signatureCount != 0) {
-    //            continue;
-    //        }
-    //
-    //        UserEfficientVideoMap shot = new UserEfficientVideoMap();
-    //        UserEfficientVideoMap plane = new UserEfficientVideoMap();
-    //        UserEfficientVideoMap plan = new UserEfficientVideoMap();
-    //        UserEfficientVideoMap clip = new UserEfficientVideoMap();
-    //
-    //        //拍摄
-    //        shot.setUserId(effiVideoDTO.getShotId());
-    //        shot.setEfficientVideoSignature(effiVideoDTO.getSignature());
-    //        shot.setQuarter(thisQuarter);
-    //        shot.setAppType(2); //1头条 2快手
-    //        shot.setYear(thisYear);
-    //        shot.setMonth(thisMonth);
-    //        shot.setCalcDate(calcDate);
-    //        shot.setRoleId("7bff9afed625aeeabca6bffe3c189183");
-    //        userEfficientVideoMapMapper.insert(shot);
-    //
-    //        //平面
-    //        plane.setUserId(effiVideoDTO.getPlaneId());
-    //        plane.setEfficientVideoSignature(effiVideoDTO.getSignature());
-    //        plane.setQuarter(thisQuarter);
-    //        plane.setAppType(2); //1头条 2快手
-    //        plane.setYear(thisYear);
-    //        plane.setMonth(thisMonth);
-    //        plane.setCalcDate(calcDate);
-    //        plane.setRoleId("8dc30cb9810bde89bdc3fa8a85b830b0");
-    //        userEfficientVideoMapMapper.insert(plane);
-    //
-    //        //策划
-    //        plan.setUserId(effiVideoDTO.getPlanId());
-    //        plan.setEfficientVideoSignature(effiVideoDTO.getSignature());
-    //        plan.setQuarter(thisQuarter);
-    //        plan.setAppType(2); //1头条 2快手
-    //        plan.setYear(thisYear);
-    //        plan.setMonth(thisMonth);
-    //        plan.setCalcDate(calcDate);
-    //        plan.setRoleId("0214283aa16f943efbb149ea4bb18f18");
-    //        userEfficientVideoMapMapper.insert(plan);
-    //
-    //        //剪辑
-    //        clip.setUserId(effiVideoDTO.getClipId());
-    //        clip.setEfficientVideoSignature(effiVideoDTO.getSignature());
-    //        clip.setQuarter(thisQuarter);
-    //        clip.setAppType(2); //1头条 2快手
-    //        clip.setYear(thisYear);
-    //        clip.setMonth(thisMonth);
-    //        clip.setCalcDate(calcDate);
-    //        clip.setRoleId("f38d8d70cf7ec50d5357a749e4dbf8ee");
-    //        userEfficientVideoMapMapper.insert(clip);
-    //
-    //        //快手有效视频同步到有效视频素材库
-    //        userEfficientVideoMapMapper.updateKuaishouEffiType(1, effiVideoDTO.getSignature());
-    //
-    //    }
-    //    log.info("快手有效视频统计结束,统计时间为 " + calcDate);
-    //}
-
-    //头条有效视频计算--旧版 已废弃
-    //private void toutiaoEffiVideo(Date calcDate, String effiCalcStart, String effiCalcEnd, String effiStart, String effiEnd, int thisYear, int thisMonth, int thisQuarter) {
-    //    log.info("头条手有效视频统计开始,统计时间为 " + calcDate);
-    //    //获取时间段内所有头条的有效视频
-    //    List<EffiVideoDTO> EffiVideoDTOList = userEfficientVideoMapMapper.getToutiaoUserVideoMap(effiStart, effiEnd, effiCalcStart, effiCalcEnd);
-    //
-    //    for (EffiVideoDTO effiVideoDTO : EffiVideoDTOList) {
-    //        //判断此视频是否已经在关系表中存在,如果已经存在则说明此视频已经存在,跳过即可
-    //        //有效视频的逻辑是无论是快手还是头条
-    //        int signatureCount = userEfficientVideoMapMapper.getEffiVideoCountBySignature(effiVideoDTO.getSignature(), new Integer(1));//1头条 2快手
-    //        if (signatureCount != 0) {
-    //            continue;
-    //        }
-    //
-    //        UserEfficientVideoMap shot = new UserEfficientVideoMap();
-    //        UserEfficientVideoMap plane = new UserEfficientVideoMap();
-    //        UserEfficientVideoMap plan = new UserEfficientVideoMap();
-    //        UserEfficientVideoMap clip = new UserEfficientVideoMap();
-    //
-    //        //拍摄
-    //        shot.setUserId(effiVideoDTO.getShotId());
-    //        shot.setEfficientVideoSignature(effiVideoDTO.getSignature());
-    //        shot.setQuarter(thisQuarter);
-    //        shot.setAppType(1); //1头条 2快手
-    //        shot.setYear(thisYear);
-    //        shot.setMonth(thisMonth);
-    //        shot.setCalcDate(calcDate);
-    //        shot.setRoleId("7bff9afed625aeeabca6bffe3c189183");
-    //        //role_code shot
-    //        userEfficientVideoMapMapper.insert(shot);
-    //
-    //        //平面
-    //        plane.setUserId(effiVideoDTO.getPlaneId());
-    //        plane.setEfficientVideoSignature(effiVideoDTO.getSignature());
-    //        plane.setQuarter(thisQuarter);
-    //        plane.setAppType(1); //1头条 2快手
-    //        plane.setYear(thisYear);
-    //        plane.setMonth(thisMonth);
-    //        plane.setCalcDate(calcDate);
-    //        plane.setRoleId("8dc30cb9810bde89bdc3fa8a85b830b0");
-    //        //role_code shot
-    //        userEfficientVideoMapMapper.insert(plane);
-    //
-    //        //策划
-    //        plan.setUserId(effiVideoDTO.getPlanId());
-    //        plan.setEfficientVideoSignature(effiVideoDTO.getSignature());
-    //        plan.setQuarter(thisQuarter);
-    //        plan.setAppType(1); //1头条 2快手
-    //        plan.setYear(thisYear);
-    //        plan.setMonth(thisMonth);
-    //        plan.setCalcDate(calcDate);
-    //        plan.setRoleId("0214283aa16f943efbb149ea4bb18f18");
-    //        //role_code plan
-    //        userEfficientVideoMapMapper.insert(plan);
-    //
-    //        //剪辑
-    //        clip.setUserId(effiVideoDTO.getClipId());
-    //        clip.setEfficientVideoSignature(effiVideoDTO.getSignature());
-    //        clip.setQuarter(thisQuarter);
-    //        clip.setAppType(1); //1头条 2快手
-    //        clip.setYear(thisYear);
-    //        clip.setMonth(thisMonth);
-    //        clip.setCalcDate(calcDate);
-    //        clip.setRoleId("f38d8d70cf7ec50d5357a749e4dbf8ee");
-    //        //role_code clip
-    //        userEfficientVideoMapMapper.insert(clip);
-    //
-    //        //头条有效视频同步到有效视频素材库
-    //        userEfficientVideoMapMapper.updateToutiaoEffiType(1, effiVideoDTO.getSignature());
-    //    }
-    //    log.info("头条有效视频统计结束,统计时间为 " + calcDate);
-    //}
-    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-    //有效视频计算结束
-    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
     ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     //新有效视频计算开始
     ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -1190,7 +1044,7 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
             performance.setRoleId(designLeaderMap.get(key).getRoleId());
             performance.setQuarter(thisQuarter);
             performance.setYear(thisYear);
-            //performance.setCommissionRate(new BigDecimal("0.002")); //头条平台比例2‰
+            performance.setCommissionRate(new BigDecimal("0.002")); //头条平台比例2‰
             performance.setTotalCost(designLeaderMap.get(key).getCost());
             performance.setTotalPerformance(designLeaderMap.get(key).getEffiRate());  //头条
             //performance.setRoleCommissionRate(new BigDecimal("0.05"));
@@ -1204,43 +1058,6 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
     }
     ///////////////////////////////////////////////////////////////////////////////////////////////////////快手平面end
 
-    //////////////////////////////////////////////////////////////////////////////////////////////////快手设计师leader绩效计算start
-    //private void kuaishouDesignLeaderPerformance(int thisYear, int thisQuarter, String startTime, String endTime) {
-    //    log.info(thisYear + "年第" + thisQuarter + "季度快手设计师leader季度绩效计算开始");
-    //    //直接查询出来各种媒体类型的设计组长
-    //    List<UserDto2> designLeaderList = userEfficientVideoMapMapper.getKuaishouDesignLeaderList();
-    //
-    //    //循环list然后根据查出leader组下的剪辑userId
-    //    for (UserDto2 userDto : designLeaderList) {
-    //        List<String> clipList = userEfficientVideoMapMapper.getClip(userDto.getDepId());
-    //        BigDecimal totalCost = BigDecimal.ZERO; //剪辑总消耗
-    //
-    //        for (String clipUserId : clipList) {
-    //            BigDecimal clipCost = userEfficientVideoMapMapper.getClipQuarterCost(2, thisQuarter, thisYear, clipUserId);  //媒体类型 //1头条 2快手
-    //            totalCost = totalCost.add(clipCost);
-    //        }
-    //
-    //        //总绩效=剪辑消耗总合 * 平台比例 * 20%
-    //        BigDecimal totalPerformance = totalCost.multiply(new BigDecimal("0.003")).multiply(new BigDecimal("0.2"));
-    //
-    //        Performance performance = new Performance();
-    //        performance.setAppType(2); //1头条 2快手
-    //        performance.setRoleId(userDto.getRoleId());
-    //        performance.setQuarter(thisQuarter);
-    //        performance.setYear(thisYear);
-    //        performance.setCommissionRate(new BigDecimal("0.003"));
-    //        performance.setTotalCost(totalCost);
-    //        performance.setTotalPerformance(totalPerformance);
-    //        performance.setStartTime(startTime);
-    //        performance.setEndTime(endTime);
-    //        performance.setRoleCommissionRate(new BigDecimal("0.2"));
-    //        performance.setUserId(userDto.getUserId());
-    //        performanceMapper.insert(performance);
-    //    }
-    //    log.info(thisYear + "年第" + thisQuarter + "季度快手设计师leader季度绩效计算结束");
-    //}
-    //////////////////////////////////////////////////////////////////////////////////////////////////快手设计师leader绩效计算end
-
     ////////////////////////////////////////////////////////////////////////////////////////////
     //头条
     ////////////////////////////////////////////////////////////////////////////////////////////
@@ -1490,6 +1307,7 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
         //获取所有project根据媒体类型获取快手下的项目类型 1-头条 2-快手
         List<ProjectDTO> projectDTOS = userEfficientVideoMapMapper.getProjects("1");
 
+
         //循环project
         for (ProjectDTO projectDTO : projectDTOS) {
             //判断是否是北京的部门负责的项目,如果不是的话跳出
@@ -1626,43 +1444,7 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
     }
     ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////头条平面设计师绩效end
 
-    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////头条设计师leader绩效 start
-    //private void toutiaoDesignLeaderPerformance(int thisYear, int thisQuarter, String startTime, String endTime) {
-    //    log.info(thisYear + "年第" + thisQuarter + "季度头条设计师leader季度绩效计算开始");
-    //    //直接查询出来各种媒体类型的设计组长
-    //    List<UserDto2> designLeaderList = userEfficientVideoMapMapper.getKuaishouDesignLeaderList();
-    //
-    //    //循环list然后根据查出leader组下的剪辑userId
-    //    for (UserDto2 userDto : designLeaderList) {
-    //        List<String> clipList = userEfficientVideoMapMapper.getClip(userDto.getDepId());
-    //        BigDecimal totalCost = BigDecimal.ZERO; //剪辑总消耗
-    //
-    //        for (String clipUserId : clipList) {
-    //            BigDecimal clipCost = userEfficientVideoMapMapper.getClipQuarterCost(1, thisQuarter, thisYear, clipUserId);  //媒体类型 //1头条 2快手
-    //            totalCost = totalCost.add(clipCost);
-    //        }
-    //
-    //        //总绩效=小组下所有剪辑消耗总合 * 平台比例 * 20%
-    //        BigDecimal totalPerformance = totalCost.multiply(new BigDecimal("0.002")).multiply(new BigDecimal("0.2"));
-    //
-    //        Performance performance = new Performance();
-    //        performance.setAppType(1); //1头条 2快手
-    //        performance.setRoleId(userDto.getRoleId());
-    //        performance.setQuarter(thisQuarter);
-    //        performance.setYear(thisYear);
-    //        performance.setCommissionRate(new BigDecimal("0.002")); //千分之
-    //        performance.setRoleCommissionRate(new BigDecimal("0.2"));
-    //        performance.setTotalCost(totalCost);
-    //        performance.setTotalPerformance(totalPerformance);
-    //        performance.setStartTime(startTime);
-    //        performance.setEndTime(endTime);
-    //        performance.setUserId(userDto.getUserId());
-    //        performanceMapper.insert(performance);
-    //    }
-    //    log.info(thisYear + "年第" + thisQuarter + "季度头条设计师leader季度绩效计算开始");
-    //}
-
-    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////头条设计师leader绩效 end
+
     ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     //绩效计算结束
     /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -2725,5 +2507,13 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
         return userEfficientVideoMapMapper.getToutiaoQuarterVideoInfoByAccountId(startDate, endDate, accountId);
     }
 
+    public List<VideoDTO> getUserQuarterVideo(Integer year, Integer quarter, String userId){
+        return userEfficientVideoMapMapper.getUserQuarterVideo(userId, year, quarter);
+    }
+
+    public List<VideoDTO> getUserQuarterEffiVideo(Integer year, Integer quarter, String userId){
+        return userEfficientVideoMapMapper.getUserQuarterEffiVideo(userId, year, quarter);
+    }
+
 }
 

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

@@ -17,5 +17,11 @@ public class VideoDTO implements Serializable {
     private String plan;
     private String plane;
     private String clip;
-
+    private Integer appType;
+    private String weekStart;
+    private String weekEnd;
+    private Integer year;
+    private Integer quarter;
+    private String roleId;
+    private String roleCode;
 }

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

@@ -236,5 +236,8 @@ public interface UserEfficientVideoMapMapper extends BaseMapper<UserEfficientVid
 
     List<VideoDTO> getToutiaoQuarterVideoInfoByAccountId(@Param("startDate")String startDate, @Param("endDate")String endDate, @Param("accountId")Long accountId);
 
+    List<VideoDTO> getUserQuarterVideo(@Param("userId")String userId, @Param("year")Integer year, @Param("quarter")Integer quarter);
+
+    List<VideoDTO> getUserQuarterEffiVideo(@Param("userId")String userId, @Param("year")Integer year, @Param("quarter")Integer quarter);
 }
 

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

@@ -1629,4 +1629,52 @@
         left join sys_user d4 on d4.id = c.clip_id
     </select>
 
+    <select id="getUserQuarterVideo" resultType="cn.com.ctop.userefficientvideomap.entity.VideoDTO">
+          select
+          a.video_signature as signature,
+          a.role_id as roleId,
+          d2.role_code as roleCode,
+          a.quarter,
+          a.year,
+          a.month,
+          a.week_start as weekStart,
+          a.week_end as weekEnd,
+          a.app_type as appType,
+          b.url as creativeUrl
+        from
+        ctop_user_video_map a
+        left join (select code, url from ctop_material_info group by code) b on a.video_signature = b.code
+        left join sys_user_role c on c.user_id = a.user_id
+        left join sys_role d2 on c.role_id = d2.id
+        where
+        a.user_id = #{userId}
+        and a.year = #{year}
+        and a.quarter = #{quarter}
+        group by signature
+    </select>
+
+    <select id="getUserQuarterEffiVideo" resultType="cn.com.ctop.userefficientvideomap.entity.VideoDTO">
+          select
+          a.video_signature as signature,
+          a.role_id as roleId,
+          d2.role_code as roleCode,
+          a.quarter,
+          a.year,
+          a.month,
+          a.week_start as weekStart,
+          a.week_end as weekEnd,
+          a.app_type as appType,
+          b.url as creativeUrl
+        from
+        ctop_user_video_map a
+        left join (select code, url from ctop_material_info group by code) b on a.video_signature = b.code
+        left join sys_user_role c on c.user_id = a.user_id
+        left join sys_role d2 on c.role_id = d2.id
+        where
+        a.user_id = #{userId}
+        and a.year = #{year}
+        and a.quarter = #{quarter}
+        group by signature
+    </select>
+
 </mapper>