Parcourir la source

绩效问题修改

hcst_sunzhen il y a 5 ans
Parent
commit
19e29a8cbe

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

@@ -2,6 +2,7 @@ package org.jeecg.modules.system.controller;
 
 import cn.com.ctop.common.module.entity.MaterialInfo;
 import cn.com.ctop.performanceappraisal.entity.Performance;
+import cn.com.ctop.userefficientvideomap.entity.AccountDTO;
 import cn.com.ctop.userefficientvideomap.entity.DesignMaterialInfo;
 import cn.com.ctop.userefficientvideomap.entity.PerformanceTimeDTO;
 import cn.com.ctop.userefficientvideomap.entity.UserDto2;
@@ -329,6 +330,66 @@ public class PerformanceController2 {
         return result;
     }
 
+    @AutoLog(value = "获取快手优化师绩效时时数据接口")
+    @ApiOperation(value = "获取快手优化师绩效时时数据接口", notes = "获取快手优化师绩效时时数据接口")
+    @PostMapping(value = "/kuaishouYouhuaPerformanceInfoNow")
+    public Result<List<UserDto2>> kuaishouYouhuaPerformanceInfoNow(HttpServletRequest req) {
+        Result<List<UserDto2>> result = new Result<List<UserDto2>>();
+        List<UserDto2> userDto2List = performanceService.kuaishouYouhuaPerformanceInfoNow();
+        result.setSuccess(true);
+        result.setResult(userDto2List);
+        return result;
+    }
+
+    @AutoLog(value = "获取头条优化师绩效时时数据接口")
+    @ApiOperation(value = "获取头条优化师绩效时时数据接口", notes = "获取头条优化师绩效时时数据接口")
+    @PostMapping(value = "/toutiaoYouhuaPerformanceInfoNow")
+    public Result<List<UserDto2>> toutiaoYouhuaPerformanceInfoNow(HttpServletRequest req) {
+        Result<List<UserDto2>> result = new Result<List<UserDto2>>();
+        List<UserDto2> userDto2List = performanceService.toutiaoYouhuaPerformanceInfoNow();
+        result.setSuccess(true);
+        result.setResult(userDto2List);
+        return result;
+    }
+
+    @AutoLog(value = "获取快手优化师所属账号信息")
+    @ApiOperation(value = "获取快手优化师所属账号信息", notes = "获取快手优化师所属账号信息")
+    @PostMapping(value = "/getKuaiShouYouhuaAccountsList")
+    public Result<List<AccountDTO>> getKuaiShouYouhuaAccountsList(@RequestBody PerformanceTimeDTO dto, HttpServletRequest req) {
+        Result<List<AccountDTO>> result = new Result<>();
+        String userId = dto.getUserId();
+        Integer year = dto.getYear();
+        Integer quarter = dto.getQuarter();
+        Integer appType = dto.getAppType();
+        if(userId==null || appType == null){
+            result.setSuccess(false);
+            result.setMessage("userId和appType不能为空");
+        }
+        List<AccountDTO> accountDTOList = performanceService.getKuaiShouYouhuaAccountsList(userId, appType, year, quarter);
+        result.setSuccess(true);
+        result.setResult(accountDTOList);
+        return result;
+    }
+
+    @AutoLog(value = "获取头条优化师所属账号信息")
+    @ApiOperation(value = "获取头条优化师所属账号信息", notes = "获取头条优化师所属账号信息")
+    @PostMapping(value = "/getToutiaoYouhuaAccountsList")
+    public Result<List<AccountDTO>> getToutiaoYouhuaAccountsList(@RequestBody PerformanceTimeDTO dto, HttpServletRequest req) {
+        Result<List<AccountDTO>> result = new Result<>();
+        String userId = dto.getUserId();
+        Integer year = dto.getYear();
+        Integer quarter = dto.getQuarter();
+        Integer appType = dto.getAppType();
+        if(userId==null || appType == null){
+            result.setSuccess(false);
+            result.setMessage("userId和appType不能为空");
+        }
+        List<AccountDTO> accountDTOList = performanceService.getToutiaoYouhuaAccountsList(userId, appType, year, quarter);
+        result.setSuccess(true);
+        result.setResult(accountDTOList);
+        return result;
+    }
+
     @AutoLog(value = "获取头条绩效时时数据接口")
     @ApiOperation(value = "获取头条绩效时时数据接口", notes = "获取头条绩效时时数据接口")
     @PostMapping(value = "/toutiaoPerformanceInfoNow")

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

@@ -2,6 +2,7 @@ package org.jeecg.modules.system.service;
 
 import cn.com.ctop.common.module.entity.MaterialInfo;
 import cn.com.ctop.performanceappraisal.entity.Performance;
+import cn.com.ctop.userefficientvideomap.entity.AccountDTO;
 import cn.com.ctop.userefficientvideomap.entity.DesignMaterialInfo;
 import cn.com.ctop.userefficientvideomap.entity.UserDto2;
 import com.baomidou.mybatisplus.extension.service.IService;
@@ -89,4 +90,16 @@ public interface IPerformanceService2 extends IService<Performance> {
     //获取有效视频列表
     List<MaterialInfo> effiVideoList(Integer appType, Integer year, Integer quarter, String userId);
 
+    //获取快手优化师绩效实时数据
+    List<UserDto2> kuaishouYouhuaPerformanceInfoNow();
+
+    //获取头条优化师实时数据
+    List<UserDto2> toutiaoYouhuaPerformanceInfoNow();
+
+    //获取快手优化师所属账号信息
+    List<AccountDTO> getKuaiShouYouhuaAccountsList(String userId, Integer appType, Integer year , Integer quarter);
+
+    //获取头条优化师所属账号信息
+    List<AccountDTO> getToutiaoYouhuaAccountsList(String userId, Integer appType, Integer year , Integer quarter);
+
 }

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

@@ -1670,6 +1670,87 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
         return userDto2List;
     }
 
+    //获取快手优化师绩效时时数据接口
+    @Override
+    public List<UserDto2> kuaishouYouhuaPerformanceInfoNow() {
+        //0 获取当前季度的时间
+        Map<String, Integer> dateMap = DateUtils.getYearQuarter(new Date());
+        //Integer year = dateMap.get("year");
+        //Integer quarter = dateMap.get("quarter");
+        int year = 2019;
+        int quarter = 4;
+        Map<String, String> timeMap = DateUtils.quarterStartEndDate(year, quarter);
+        String startTime = timeMap.get("startDate");
+        String endTime = timeMap.get("endDate");
+
+        //1 获取快手下所有人
+        List<UserDto2> userDto2List = userEfficientVideoMapMapper.getKuaishouYunyingDepartUserInfo();
+        //2 循环所有人,并查询出每个人的有效视频数、总视频数、总消耗
+        for (UserDto2 userDto : userDto2List) {
+            BigDecimal cost = null;
+            cost = userEfficientVideoMapMapper.getKuaishouYunyingTotalCost(userDto.getUserId(),2,startTime, endTime);
+            if(cost == null){
+                cost = BigDecimal.ZERO;
+            }
+            userDto.setCost(cost);
+        }
+        return userDto2List;
+    }
+
+    //获取头条优化师绩效时时数据接口
+    @Override
+    public List<UserDto2> toutiaoYouhuaPerformanceInfoNow() {
+        //0 获取当前季度的时间
+        Map<String, Integer> dateMap = DateUtils.getYearQuarter(new Date());
+        //Integer year = dateMap.get("year");
+        //Integer quarter = dateMap.get("quarter");
+        int year = 2019;
+        int quarter = 4;
+        Map<String, String> timeMap = DateUtils.quarterStartEndDate(year, quarter);
+        String startTime = timeMap.get("startDate");
+        String endTime = timeMap.get("endDate");
+
+        //1 获取快手下所有人
+        List<UserDto2> userDto2List = userEfficientVideoMapMapper.getKuaishouYunyingDepartUserInfo();
+        //2 循环所有人,并查询出每个人的有效视频数、总视频数、总消耗
+        for (UserDto2 userDto : userDto2List) {
+            BigDecimal cost = null;
+            cost = userEfficientVideoMapMapper.getToutiaoYunyingTotalCost(userDto.getUserId(),1,startTime, endTime);
+            if(cost == null){
+                cost = BigDecimal.ZERO;
+            }
+            userDto.setCost(cost);
+        }
+        return userDto2List;
+    }
+
+    //获取快手优化师所属账号的消耗等信息
+    public List<AccountDTO> getKuaiShouYouhuaAccountsList(String userId, Integer appType, Integer year , Integer quarter){
+        if(year == null || quarter == null){
+            Map<String, Integer> dateMap = DateUtils.getYearQuarter(new Date());
+            year = dateMap.get("year");
+            quarter = dateMap.get("quarter");
+        }
+        Map<String, String> timeMap = DateUtils.quarterStartEndDate(year, quarter);
+        String startTime = timeMap.get("startDate");
+        String endTime = timeMap.get("endDate");
+        return userEfficientVideoMapMapper.getKuaishouAccountTotalCost(userId, appType, startTime, endTime);
+    }
+
+    //获取头条优化师所属账号的消耗等信息
+    @Override
+    public List<AccountDTO> getToutiaoYouhuaAccountsList(String userId, Integer appType, Integer year, Integer quarter){
+        if(year == null || quarter == null){
+            Map<String, Integer> dateMap = DateUtils.getYearQuarter(new Date());
+            year = dateMap.get("year");
+            quarter = dateMap.get("quarter");
+        }
+        Map<String, String> timeMap = DateUtils.quarterStartEndDate(year, quarter);
+        String startTime = timeMap.get("startDate");
+        String endTime = timeMap.get("endDate");
+        return userEfficientVideoMapMapper.getToutiaoAccountTotalCost(userId, appType, startTime, endTime);
+    }
+
     //获取头条绩效实时数据
     public List<UserDto2> toutiaoPerformanceInfoNow() {
         //0 获取当前季度的时间

+ 17 - 0
performance-appraisal/src/main/java/cn/com/ctop/userefficientvideomap/entity/AccountDTO.java

@@ -0,0 +1,17 @@
+package cn.com.ctop.userefficientvideomap.entity;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+
+@Data
+public class AccountDTO implements Serializable {
+    private Long projectId;
+    private String projectName;
+    private String totalCost;  //消耗
+    private String accountId;  //账户id
+    private String userName;  //优化师
+    private String advertiserName;  //广告主名称
+    private String authName;  //授权名称
+}

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

@@ -123,10 +123,10 @@ public interface UserEfficientVideoMapMapper extends BaseMapper<UserEfficientVid
     BigDecimal getKuaishouYunyingTotalCost(@Param("userId")String userId, @Param("appType")Integer appType, @Param("startDate")String startDate, @Param("endDate")String endDate);
     //获取快手单个优化师当前账户下的总消耗
     BigDecimal getToutiaoYunyingTotalCost(@Param("userId")String userId, @Param("appType")Integer appType, @Param("startDate")String startDate, @Param("endDate")String endDate);
+    //获取快手单个优化师其下所有的账户下当前的消耗
+    List<AccountDTO> getKuaishouAccountTotalCost(@Param("userId")String userId, @Param("appType")Integer appType, @Param("startDate")String startDate, @Param("endDate")String endDate);
     //获取头条单个优化师其下所有的账户下当前的消耗
-    List<BigDecimal> getKuaishouAccountTotalCost(@Param("userId")String userId, @Param("appType")Integer appType, @Param("startDate")String startDate, @Param("endDate")String endDate);
-    //获取头条单个优化师其下所有的账户下当前的消耗
-    List<BigDecimal> getToutiaoAccountTotalCost(@Param("userId")String userId, @Param("appType")Integer appType, @Param("startDate")String startDate, @Param("endDate")String endDate);
+    List<AccountDTO> getToutiaoAccountTotalCost(@Param("userId")String userId, @Param("appType")Integer appType, @Param("startDate")String startDate, @Param("endDate")String endDate);
 
 
 

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

@@ -759,7 +759,7 @@
         WHERE b.parent_id = '0dd29c09d2c94f98ae91902094c6cf68'  <!-- 快手运营部 -->
     </select>
 
-    <!-- 获取北京快手运营部所有优化师得信息 -->
+    <!-- 获取北京头条运营部所有优化师得信息 -->
     <select id="getToutiaoYunyingDepartUserInfo" resultType="cn.com.ctop.userefficientvideomap.entity.UserDto2">
         select u.id as userId,
         u.realname as realname,
@@ -805,15 +805,21 @@
         AND
             dailiAccount.stat_datetime &gt;= #{startDate}
         AND
-            dailiAccount.stat_datetime &lt; #{endDate}
+            dailiAccount.stat_datetime &lt;= #{endDate}
         AND
             allocation.media_id = #{appType}
     </select>
 
     <!-- 获取头条单个优化师其下所有的账户下当前的消耗 -->
-    <select id="getToutiaoAccountTotalCost" resultType="java.math.BigDecimal">
+    <select id="getToutiaoAccountTotalCost" resultType="cn.com.ctop.userefficientvideomap.entity.AccountDTO">
             select
-            SUM(dailiAccount.charge) as totalCost
+            SUM(dailiAccount.cost) as totalCost,  <!-- 账户当前消耗 -->
+            allocation.account_id as accountId,  <!-- 账户id -->
+            allocation.user_name as userName,  <!-- 优化师 -->
+            allocation.advertiser_name as advertiserName,  <!-- 广告主名称 -->
+            allocation.project_name as projectName,  <!-- 项目名称 -->
+            allocation.auth_name as authName <!-- 授权名称 -->
+        from
         ctop_bytedance_report_advertiser_daily dailiAccount
         LEFT JOIN
         ctop_user_allocation allocation ON dailiAccount.advertiser_id = allocation.account_id
@@ -822,17 +828,21 @@
         AND
             dailiAccount.stat_datetime &gt;= #{startDate}
         AND
-            dailiAccount.stat_datetime &lt; #{endDate}
+            dailiAccount.stat_datetime &lt;= #{endDate}
         AND
             allocation.media_id = #{appType}
         group by dailiAccount.advertiser_id
     </select>
 
     <!-- 获取快手单个优化师其下所有账户下当前的消耗 -->
-    <select id="getKuaishouAccountTotalCost" resultType="java.math.BigDecimal">
-        SELECT
-
-            SUM(dailiAccount.charge) as totalCost
+    <select id="getKuaishouAccountTotalCost" resultType="cn.com.ctop.userefficientvideomap.entity.AccountDTO">
+            SELECT
+            SUM(dailiAccount.charge) as totalCost,  <!-- 账户当前消耗 -->
+            allocation.account_id as accountId,  <!-- 账户id -->
+            allocation.user_name as userName,  <!-- 优化师 -->
+            allocation.advertiser_name as advertiserName,  <!-- 广告主名称 -->
+            allocation.project_name as projectName,  <!-- 项目名称 -->
+            allocation.auth_name as authName <!-- 授权名称 -->
         FROM
             ctop_kuaishou_report_daily_account dailiAccount
         LEFT JOIN
@@ -842,7 +852,7 @@
         AND
             dailiAccount.stat_date &gt;= #{startDate}
         AND
-            dailiAccount.stat_date &lt; #{endDate}
+            dailiAccount.stat_date &lt;= #{endDate}
         AND
             allocation.media_id = #{appType}
         group by dailiAccount.account_id