Sfoglia il codice sorgente

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

syh 5 anni fa
parent
commit
0148a21dcf

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

@@ -439,6 +439,46 @@ public class PerformanceController2 {
         return result;
     }
 
+    //快手优化师周报
+    @AutoLog(value = "获取快手优化师绩效周报表")
+    @ApiOperation(value = "获取快手优化师绩效周报表", notes = "获取快手优化师绩效周报表")
+    @PostMapping(value = "/kuaishouYouhuaWeekReport")
+    public Result<List<UserDto2>> kuaishouYouhuaWeekReport(@RequestBody PerformanceTimeDTO dto,
+                                                     HttpServletRequest req) {
+        Result<List<UserDto2>> result = new Result<List<UserDto2>>();
+        String startDate = dto.getStartDate();
+        String endDate = dto.getEndDate();
+        if(StringUtils.isBlank(startDate) || StringUtils.isBlank(endDate)){
+            result.setSuccess(false);
+            result.setMessage("时间不能为空");
+            return result;
+        }
+        List<UserDto2> userDto2List = performanceService.kuaishouYouhuaWeekReport(startDate, endDate);
+        result.setSuccess(true);
+        result.setResult(userDto2List);
+        return result;
+    }
+
+    //头条优化师周报
+    @AutoLog(value = "获取头条优化师绩效周报表")
+    @ApiOperation(value = "获取头条优化师绩效周报表", notes = "获取头条绩效周报表")
+    @PostMapping(value = "/toutiaoYouhuaWeekReport")
+    public Result<List<UserDto2>> toutiaoYouhuaWeekReport(@RequestBody PerformanceTimeDTO dto,
+                                                    HttpServletRequest req) {
+        Result<List<UserDto2>> result = new Result<List<UserDto2>>();
+        String startDate = dto.getStartDate();
+        String endDate = dto.getEndDate();
+        if(StringUtils.isBlank(startDate) || StringUtils.isBlank(endDate)){
+            result.setSuccess(false);
+            result.setMessage("时间不能为空");
+            return result;
+        }
+        List<UserDto2> userDto2List = performanceService.toutiaoYouhuaWeekReport(startDate, endDate);
+        result.setSuccess(true);
+        result.setResult(userDto2List);
+        return result;
+    }
+
     @AutoLog(value = "获取快手季度绩效报表")
     @ApiOperation(value = "获取快手季度绩效报表", notes = "获取快手季度绩效报表")
     @PostMapping(value = "/kuaishouQuarterReport")
@@ -495,4 +535,43 @@ public class PerformanceController2 {
         return result;
     }
 
+    //快手优化季度绩效报表
+    //List<UserDto2> kuaishouYouhuaQuarterReport(Integer year, Integer quarter);
+    @AutoLog(value = "快手优化季度绩效报表")
+    @ApiOperation(value = "快手优化季度绩效报表", notes = "快手优化季度绩效报表")
+    @PostMapping(value = "/kuaishouYouhuaQuarterReport")
+    public Result<List<UserDto2>> kuaishouYouhuaQuarterReport(@RequestBody PerformanceTimeDTO dto,
+                                                             HttpServletRequest req) {
+        Result<List<UserDto2>> result = new Result<List<UserDto2>>();
+        Integer year = dto.getYear();
+        Integer quarter = dto.getQuarter();
+        if(year==null || quarter == null){
+            result.setSuccess(false);
+            result.setMessage("时间不能为空");
+        }
+        List<UserDto2> userDto2List = performanceService.kuaishouYouhuaQuarterReport(year, quarter);
+        result.setSuccess(true);
+        result.setResult(userDto2List);
+        return result;
+    }
+
+    //头条优化季度绩效报表
+    @AutoLog(value = "头条优化季度绩效报表")
+    @ApiOperation(value = "头条优化季度绩效报表", notes = "头条优化季度绩效报表")
+    @PostMapping(value = "/toutiaoYouhuaQuarterReport")
+    public Result<List<UserDto2>> toutiaoYouhuaQuarterReport(@RequestBody PerformanceTimeDTO dto,
+                                                       HttpServletRequest req) {
+        Result<List<UserDto2>> result = new Result<List<UserDto2>>();
+        Integer year = dto.getYear();
+        Integer quarter = dto.getQuarter();
+        if(year==null || quarter == null){
+            result.setSuccess(false);
+            result.setMessage("时间不能为空");
+        }
+        List<UserDto2> userDto2List = performanceService.toutiaoYouhuaQuarterReport(year, quarter);
+        result.setSuccess(true);
+        result.setResult(userDto2List);
+        return result;
+    }
+
 }

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

@@ -102,4 +102,15 @@ public interface IPerformanceService2 extends IService<Performance> {
     //获取头条优化师所属账号信息
     List<AccountDTO> getToutiaoYouhuaAccountsList(String userId, Integer appType, Integer year , Integer quarter);
 
+    //快手优化师周报
+    List<UserDto2> kuaishouYouhuaWeekReport(String startDate, String endDate);
+
+    //头条优化师周报
+    List<UserDto2> toutiaoYouhuaWeekReport(String startDate, String endDate);
+
+    //快手优化季度绩效报表
+    List<UserDto2> kuaishouYouhuaQuarterReport(Integer year, Integer quarter);
+
+    //头条优化季度绩效报表
+    List<UserDto2> toutiaoYouhuaQuarterReport(Integer year, Integer quarter);
 }

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

@@ -1660,6 +1660,7 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
             userDto.setCost(cost);
             userDto.setVideoCount(videoCount);
             userDto.setEffiVideoCount(effiVideoCount);
+            userDto.setAppType(2);
         }
         return userDto2List;
     }
@@ -1687,6 +1688,7 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
                 cost = BigDecimal.ZERO;
             }
             userDto.setCost(cost);
+            userDto.setAppType(2);
         }
         return userDto2List;
     }
@@ -1714,6 +1716,43 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
                 cost = BigDecimal.ZERO;
             }
             userDto.setCost(cost);
+            userDto.setAppType(1);
+        }
+        return userDto2List;
+    }
+
+    //获取快手优化师绩效周报
+    @Override
+    public List<UserDto2> kuaishouYouhuaWeekReport(String startDate, String endDate) {
+        //1 获取快手下所有人
+        List<UserDto2> userDto2List = userEfficientVideoMapMapper.getKuaishouYunyingDepartUserInfo();
+        //2 循环所有人,并查询出每个优化师的总消耗
+        for (UserDto2 userDto : userDto2List) {
+            BigDecimal cost = null;
+            cost = userEfficientVideoMapMapper.getKuaishouYunyingTotalCost(userDto.getUserId(),2,startDate, endDate);
+            if(cost == null){
+                cost = BigDecimal.ZERO;
+            }
+            userDto.setCost(cost);
+            userDto.setAppType(2);
+        }
+        return userDto2List;
+    }
+
+    //获取头条优化师绩效周报
+    @Override
+    public List<UserDto2> toutiaoYouhuaWeekReport(String startDate, String endDate) {
+        //1 获取快手下所有人
+        List<UserDto2> userDto2List = userEfficientVideoMapMapper.getToutiaoYunyingDepartUserInfo();
+        //2 循环所有人,并查询出每个人的有效视频数、总视频数、总消耗
+        for (UserDto2 userDto : userDto2List) {
+            BigDecimal cost = null;
+            cost = userEfficientVideoMapMapper.getToutiaoYunyingTotalCost(userDto.getUserId(),1,startDate, endDate);
+            if(cost == null){
+                cost = BigDecimal.ZERO;
+            }
+            userDto.setCost(cost);
+            userDto.setAppType(1);
         }
         return userDto2List;
     }
@@ -1779,11 +1818,12 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
             userDto.setCost(cost);
             userDto.setVideoCount(videoCount);
             userDto.setEffiVideoCount(effiVideoCount);
+            userDto.setAppType(1);
         }
         return userDto2List;
     }
 
-    //快手绩效周报数据接口
+    //快手绩效周报
     @Override
     public List<UserDto2> kuaishouWeekReport(String startDate, String endDate) {
         //1 获取快手下所有人
@@ -1815,7 +1855,7 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
         return userDto2List;
     }
 
-    //头条绩效实时数据
+    //头条绩效周报
     public List<UserDto2> toutiaoWeekReport(String startDate, String endDate) {
         //1 获取头条所有人
         List<UserDto2> userDto2List = userEfficientVideoMapMapper.getToutiaoDepartUserInfo();
@@ -1923,5 +1963,51 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
         return materialInfoList;
     }
 
+    //快手优化季度绩效报表
+    //@Override
+    public List<UserDto2> kuaishouYouhuaQuarterReport(Integer year, Integer quarter) {
+        //1 获取快手下所有人
+        List<UserDto2> userDto2List = userEfficientVideoMapMapper.getKuaishouYunyingDepartUserInfo();
+        //2 循环所有人,并查询出每个人的有效视频数、总视频数、总消耗
+        for (UserDto2 userDto : userDto2List) {
+            //总消耗
+            BigDecimal cost = userEfficientVideoMapMapper.getQuarterCost(userDto.getUserId(), year, quarter, 2);
+            if (cost == null) {
+                cost = BigDecimal.ZERO;
+            }
+            //当季度绩效
+            BigDecimal performance = userEfficientVideoMapMapper.getQuarterPerformance(userDto.getUserId(), year, quarter, 2);
+            userDto.setEffiRate(performance);
+            userDto.setCost(cost);
+            userDto.setYear(year);
+            userDto.setQuarter(quarter);
+            userDto.setAppType(2);
+        }
+        return userDto2List;
+    }
+
+    //头条优化季度绩效报表
+    //@Override
+    public List<UserDto2> toutiaoYouhuaQuarterReport(Integer year, Integer quarter) {
+        //1 获取快手下所有人
+        List<UserDto2> userDto2List = userEfficientVideoMapMapper.getToutiaoYunyingDepartUserInfo();
+        //2 循环所有人,并查询出每个人的有效视频数、总视频数、总消耗
+        for (UserDto2 userDto : userDto2List) {
+            //总消耗
+            BigDecimal cost = userEfficientVideoMapMapper.getQuarterCost(userDto.getUserId(), year, quarter, 1);
+            if (cost == null) {
+                cost = BigDecimal.ZERO;
+            }
+            //当季度绩效
+            BigDecimal performance = userEfficientVideoMapMapper.getQuarterPerformance(userDto.getUserId(), year, quarter, 1);
+            userDto.setEffiRate(performance);
+            userDto.setCost(cost);
+            userDto.setYear(year);
+            userDto.setQuarter(quarter);
+            userDto.setAppType(1);
+        }
+        return userDto2List;
+    }
+
 }
 

+ 7 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaiShouCreativeService.java

@@ -14,4 +14,11 @@ import java.util.List;
 public interface IKuaiShouCreativeService extends IService<KuaiShouCreative> {
 
     void replaceBatch(List<KuaiShouCreative> creatives);
+
+    /**
+     * 获取MD5
+     * @param creativeId
+     * @return
+     */
+    String getCodeByCreativeId(Long creativeId);
 }

+ 29 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouCreativeServiceImpl.java

@@ -1,8 +1,12 @@
 package cn.com.ctop.kuaishou.modules.batch.service.impl;
 
+import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouCreative;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouVideoGet;
 import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouCreativeMapper;
+import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouVideoGetMapper;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouCreativeService;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -19,9 +23,34 @@ import java.util.List;
 public class KuaiShouCreativeServiceImpl extends ServiceImpl<KuaiShouCreativeMapper, KuaiShouCreative> implements IKuaiShouCreativeService {
     @Autowired
     private KuaiShouCreativeMapper kuaiShouCreativeMapper;
+    @Autowired
+    private KuaiShouVideoGetMapper kuaiShouVideoGetMapper;
 
     @Override
     public void replaceBatch(List<KuaiShouCreative> creatives) {
         kuaiShouCreativeMapper.replaceBatch(creatives);
     }
+
+    @Override
+    public String getCodeByCreativeId(Long creativeId) {
+        QueryWrapper<KuaiShouCreative> creativeQueryWrapper = new QueryWrapper<>();
+        creativeQueryWrapper.eq("creative_id", creativeId);
+        creativeQueryWrapper.orderByDesc("create_time");
+        creativeQueryWrapper.last("limit 1");
+        KuaiShouCreative kuaiShouCreative = kuaiShouCreativeMapper.selectOne(creativeQueryWrapper);
+        if (!Check.isNull(kuaiShouCreative)) {
+            String photoId = kuaiShouCreative.getPhotoId();
+            if (!Check.isNull(photoId)) {
+                QueryWrapper<KuaiShouVideoGet> videoGetQueryWrapper = new QueryWrapper<>();
+                videoGetQueryWrapper.eq("photo_id", photoId);
+                videoGetQueryWrapper.orderByDesc("create_time");
+                videoGetQueryWrapper.last("limit 1");
+                KuaiShouVideoGet kuaiShouVideoGet = kuaiShouVideoGetMapper.selectOne(videoGetQueryWrapper);
+                if (!Check.isNull(kuaiShouVideoGet)) {
+                    return kuaiShouVideoGet.getSignature();
+                }
+            }
+        }
+        return null;
+    }
 }

+ 17 - 7
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl.java

@@ -309,16 +309,16 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
                 kuaiShouVideoGet.setId(token.getAccountId() + kuaiShouVideoGet.getPhotoId());
                 kuaiShouVideoGet.setAccountId(token.getAccountId());
 
-            //    kuaiShouVideoGet.setCreateTime(new Date());
+                //    kuaiShouVideoGet.setCreateTime(new Date());
                 kuaiShouVideoGet.setUpdateTime(new Date());
                 Integer type = MaterialEnum.getTypeBySize(kuaiShouVideoGet.getWidth(), kuaiShouVideoGet.getHeight());
                 if (!Check.isNull(type)) {
                     kuaiShouVideoGet.setMaterialType(type);
                 }
                 kuaiShouVideoGetService.saveOrUpdate(kuaiShouVideoGet);
-               // videoGets.add(kuaiShouVideoGet);
+                // videoGets.add(kuaiShouVideoGet);
             }
-         //   kuaiShouVideoGetService.replaceBatch(videoGets);
+            //   kuaiShouVideoGetService.replaceBatch(videoGets);
             getVideoListByPage(token, startDate, endDate, page + 1);
 
         } catch (Exception e) {
@@ -781,8 +781,12 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
         headers.put("Content-Type", "application/json");
         headers.put("Access-Token", token.getAccessToken());
         Map<String, Object> param = new HashMap<String, Object>();
-        param.put("start_date", DateUtils.formatDate(startDate));
-        param.put("end_date", DateUtils.formatDate(endDate));
+        if (!Check.isNull(startDate)) {
+            param.put("start_date", DateUtils.formatDate(startDate));
+        }
+        if (!Check.isNull(endDate)) {
+            param.put("end_date", DateUtils.formatDate(endDate));
+        }
         param.put("advertiser_id", token.getAccountId());
         param.put("temporal_granularity", "DAILY");
         param.put("page_size", 500);
@@ -810,6 +814,12 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
             var creative = JSONObject.toJavaObject(detailJson, KuaishouReportDailyCreative.class);
             creative.setAccountId(token.getAccountId());
             creative.setId("" + creative.getAccountId() + creative.getCreativeId() + creative.getStatDate());
+
+            // 取得MD5
+            String signature = creativeService.getCodeByCreativeId(creative.getCreativeId());
+            if (!Check.isNull(signature)) {
+                creative.setSignature(signature);
+            }
             KuaishouReportDailyCreativeStatistic statistic = setDailyStatistic(creative, token);
             dailyCreativeStatisticService.saveOrUpdate(statistic);
             dailyCreativeService.saveOrUpdate(creative);
@@ -3428,10 +3438,10 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
             kuaiShouVideoGet.setId("" + accountId + kuaiShouVideoGet.getPhotoId());
             kuaiShouVideoGet.setCreateTime(new Date());
             kuaiShouVideoGet.setUpdateTime(new Date());
-          //  videoGets.add(kuaiShouVideoGet);
+            //  videoGets.add(kuaiShouVideoGet);
             kuaiShouVideoGetService.saveOrUpdate(kuaiShouVideoGet);
         }
-       // kuaiShouVideoGetService.replaceBatch(videoGets);
+        // kuaiShouVideoGetService.replaceBatch(videoGets);
         getVideoList(token, accountId, startDate, endDate, page + 1);
     }
 

+ 3 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/KuaishouReportDailyCreative.java

@@ -118,6 +118,9 @@ public class KuaishouReportDailyCreative implements Serializable {
     @JsonProperty
     private BigDecimal eventCreditGrantLandingPageCost;
     @JsonProperty
+    private String signature;
+
+    @JsonProperty
     private Date createTime;
     @JsonProperty
     private Date updateTime;

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

@@ -38,4 +38,5 @@ public class UserDto2 implements Serializable {
 
     private BigDecimal cost;
 
+    private Integer appType;
 }

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

@@ -500,12 +500,12 @@
     <!-- 头条根据plan_id获取视频总消耗 -->
     <select id="toutiaoGetTotalCostByPlanId" resultType="java.math.BigDecimal">
             select
-            sum(a.charge) as charge
-            ctop_bytedance_report_creative_daily a
+            sum(a.cost) as charge
+        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 ctop_material_ascription e 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}
@@ -515,12 +515,12 @@
     <!-- 头条根据clip_id获取视频总消耗 -->
     <select id="toutiaoGetTotalCostByClipId" resultType="java.math.BigDecimal">
             select
-            sum(a.charge) as charge
-            ctop_bytedance_report_creative_daily a
+            sum(a.cost) as charge
+         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 ctop_material_ascription e 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}
@@ -530,12 +530,12 @@
     <!-- 头条根据shot_id获取视频总消耗 -->
     <select id="toutiaoGetTotalCostByShotId" resultType="java.math.BigDecimal">
             select
-            sum(a.charge) as charge
-            ctop_bytedance_report_creative_daily a
+            sum(a.cost) as charge
+           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 ctop_material_ascription e 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}
@@ -787,7 +787,7 @@
         AND
             dailiAccount.stat_date &gt;= #{startDate}
         AND
-            dailiAccount.stat_date &lt; #{endDate}
+            dailiAccount.stat_date &lt;= #{endDate}
         AND
             allocation.media_id = #{appType}
     </select>
@@ -795,7 +795,7 @@
     <!-- 获取头条单个优化师当前账户下的总消耗 -->
     <select id="getToutiaoYunyingTotalCost" resultType="java.math.BigDecimal">
         SELECT
-            SUM(dailiAccount.charge) as totalCost
+            SUM(dailiAccount.cost) as totalCost
         FROM
             ctop_bytedance_report_advertiser_daily dailiAccount
         LEFT JOIN