Parcourir la source

有效视频、素材列表

sunzhen il y a 5 ans
Parent
commit
2a69874ec8

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

@@ -1,5 +1,6 @@
 package org.jeecg.modules.system.service.impl;
 
+import cn.com.ctop.common.module.entity.MaterialInfo;
 import cn.com.ctop.performanceappraisal.entity.Performance;
 import cn.com.ctop.performanceappraisal.mapper.PerformanceMapper;
 import cn.com.ctop.planeprojectcost.entity.PlaneProjectCost;
@@ -155,6 +156,10 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
             clip.setCalcDate(calcDate);
             clip.setRoleId("f38d8d70cf7ec50d5357a749e4dbf8ee");
             userEfficientVideoMapMapper.insert(clip);
+
+            //快手有效视频同步到有效视频素材库
+            userEfficientVideoMapMapper.updateKuaishouEffiType(1, effiVideoDTO.getSignature());
+
         }
         log.info("快手有效视频统计结束,统计时间为 " + calcDate);
     }
@@ -225,6 +230,9 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
             clip.setRoleId("f38d8d70cf7ec50d5357a749e4dbf8ee");
             //role_code clip
             userEfficientVideoMapMapper.insert(clip);
+
+            //头条有效视频同步到有效视频素材库
+            userEfficientVideoMapMapper.updateToutiaoEffiType(1, effiVideoDTO.getSignature());
         }
         log.info("头条有效视频统计结束,统计时间为 " + calcDate);
     }

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

@@ -116,4 +116,8 @@ public class MaterialInfo {
     @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
     private Date updateTime;
 
+    private Integer toutiaoEffiType; //判断是否为头条有效素材0否_1是
+
+    private Integer kuaishouEffiType; //判断是否为快手有效素材0否_1是
+
 }

+ 37 - 0
module-report/src/main/java/cn/com/ctop/bytedance/controller/BytedanceCreativeDailyReportController.java

@@ -3,6 +3,7 @@ package cn.com.ctop.bytedance.controller;
 import cn.com.ctop.bytedance.entity.BytedanceCreativeDailyReport;
 import cn.com.ctop.bytedance.service.IBytedanceCreativeDailyReportService;
 import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -245,4 +246,40 @@ public class BytedanceCreativeDailyReportController {
         return Result.ok("文件导入失败!");
     }
 
+    /**
+     * bytedanceCreativeDailyReportList
+     *
+     * @param json
+     * @return
+     */
+    @AutoLog(value = "头条素材报表")
+    @ApiOperation(value = "头条素材报表", notes = "头条素材报表")
+    @PostMapping(value = "/bytedanceCreativeDailyReportList")
+    public Result<List<BytedanceCreativeDailyReport>> bytedanceCreativeDailyReportList(@RequestBody JSONObject json,
+            HttpServletRequest request, HttpServletResponse response) {
+        Result<List<BytedanceCreativeDailyReport>> result = new Result<>();
+        List<BytedanceCreativeDailyReport> bytedanceCreativeDailyReportList= bytedanceCreativeDailyReportService.bytedanceCreativeDailyReportList(json);
+        result.setResult(bytedanceCreativeDailyReportList);
+        result.setSuccess(true);
+        return result;
+    }
+
+    /**
+     * bytedanceCreativeAccountReportList
+     *
+     * @param json
+     * @return
+     */
+    @AutoLog(value = "头条素材账户报表")
+    @ApiOperation(value = "头条素材账户报表", notes = "头条素材账户报表")
+    @PostMapping(value = "/bytedanceCreativeAccountReportList")
+    public Result<List<BytedanceCreativeDailyReport>> bytedanceCreativeAccountReportList(@RequestBody JSONObject json,
+                                                                                       HttpServletRequest request, HttpServletResponse response) {
+        Result<List<BytedanceCreativeDailyReport>> result = new Result<>();
+        List<BytedanceCreativeDailyReport> bytedanceCreativeDailyReportList= bytedanceCreativeDailyReportService.bytedanceCreativeAccountReportList(json);
+        result.setResult(bytedanceCreativeDailyReportList);
+        result.setSuccess(true);
+        return result;
+    }
+
 }

+ 10 - 0
module-report/src/main/java/cn/com/ctop/bytedance/entity/BytedanceCreativeDailyReport.java

@@ -400,6 +400,16 @@ public class BytedanceCreativeDailyReport {
     @ApiModelProperty(value = "updateTime")
     private Date updateTime;
 
+    private String videoUrl;
+
+    public String getVideoUrl() {
+        return videoUrl;
+    }
+
+    public void setVideoUrl(String videoUrl) {
+        this.videoUrl = videoUrl;
+    }
+
     public BytedanceCreativeDailyReport(JSONObject data, Long setAdvertiserId) {
         Long playFeedBreak75 = data.getLong("play_75_feed_break");
         if (null != playFeedBreak75) {

+ 7 - 0
module-report/src/main/java/cn/com/ctop/bytedance/mapper/BytedanceCreativeDailyReportMapper.java

@@ -3,6 +3,9 @@ package cn.com.ctop.bytedance.mapper;
 import cn.com.ctop.bytedance.entity.BytedanceCreativeDailyReport;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 
+import java.util.List;
+import java.util.Map;
+
 /**
  * @Description: 广告创意日报表信息
  * @Author: jeecg-boot
@@ -10,5 +13,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  * @Version: V1.0
  */
 public interface BytedanceCreativeDailyReportMapper extends BaseMapper<BytedanceCreativeDailyReport> {
+    List<BytedanceCreativeDailyReport> bytedanceCreativeDailyReport(Map<String, Object> paramsMap);
+
+    List<BytedanceCreativeDailyReport> bytedanceCreativeAccountReport(Map<String, Object> paramsMap);
+
 
 }

+ 91 - 0
module-report/src/main/java/cn/com/ctop/bytedance/mapper/xml/BytedanceCreativeDailyReportMapper.xml

@@ -1,5 +1,96 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="cn.com.ctop.bytedance.mapper.BytedanceCreativeDailyReportMapper">
+    <select id="bytedanceCreativeDailyReport" parameterType="Map" resultType="cn.com.ctop.bytedance.entity.BytedanceCreativeDailyReport">
+            select
+            sum(t2.show_num) as showNum,  <!-- 展示量 -->
+            sum(t2.click) as click,  <!-- 点击量 -->
+            sum(t2.convert_num) as convertNum,  <!-- 转化量 -->
+            sum(t2.cost) as cost,  <!-- 总花费 -->
+            sum(t2.active) as active, <!-- 应用下载-激活 -->
+            sum(t2.download_finish) as downloadFinish,  <!-- 应用下载-安卓下载完成 -->
+            sum(t2.click_install) as clickInstall,  <!-- 应用下载-点击安装数 -->
+            sum(t2.in_app_pay) as inAppPay, <!-- 应用下载-付费 -->
+            sum(t2.total_play) as totalPlay, <!-- 视频-总播放 -->
+            sum(t2.valid_play) as validPlay, <!-- 视频-有效播放 -->
+            sum(t2.wifi_play) as wifiPlay, <!-- 视频-wifi播放 -->
+            sum(t2.play100_feed_break) as play100FeedBreak,  <!-- 视频-播放100%进度总数 -->
+            sum(t2.play75_feed_break) as play75FeedBreak,  <!-- 视频-播放75%进度总数 -->
+            sum(t2.comment) as comment,  <!-- 互动数据-评论数 -->
+            AVG(t2.next_day_open) as nextDayOpen,  <!-- 次留数 -->
+            AVG(t2.next_day_open_rate) as nextDayOpenRate,  <!-- 次留率 -->
+            AVG(t2.next_day_open_cost) as nextDayOpenCost  <!-- 次留成本 -->
+        from
+        ctop_user_allocation t1
+        left join ctop_bytedance_report_creative_daily t2 on t1.account_id = t2.advertiser_id
+        left join ctop_bytedance_creative t3 on t2.creative_id = t3.id
+        left join ctop_bytedance_video_info t4 on t3.video_id = t4.id
+        <where>
+            <if test="userId != null">
+                and t1.user_id = #{userId,jdbcType=VARCHAR}
+            </if>
+            and t1.media_id = '1'
+            and t1.account_id != ''
+            <if test="startDate != null">
+                and t2.stat_datetime &lt;= #{startDate}
+            </if>
+            <if test="endDate != null">
+                and t2.stat_datetime &gt;= #{endDate}
+            </if>
+        </where>
+        group by t4.signature
+        order by sum(t2.cost) desc
+        limit 100
+    </select>
+
+    <select id="bytedanceCreativeAccountReport" parameterType="Map" resultType="cn.com.ctop.bytedance.entity.BytedanceCreativeDailyReport">
+        select
+        t2.creative_id as creativeId,  <!-- 素材id -->
+        t4.video_url as videoUrl,  <!-- 视频url -->
+        sum(t2.show_num) as showNum,  <!-- 展示量 -->
+        sum(t2.click) as click,  <!-- 点击量 -->
+        sum(t2.convert_num) as convertNum,  <!-- 转化量 -->
+        sum(t2.cost) as cost,  <!-- 总花费 -->
+        sum(t2.active) as active, <!-- 应用下载-激活 -->
+        sum(t2.download_finish) as downloadFinish,  <!-- 应用下载-安卓下载完成 -->
+        sum(t2.click_install) as clickInstall,  <!-- 应用下载-点击安装数 -->
+        sum(t2.in_app_pay) as inAppPay, <!-- 应用下载-付费 -->
+        sum(t2.total_play) as totalPlay, <!-- 视频-总播放 -->
+        sum(t2.valid_play) as validPlay, <!-- 视频-有效播放 -->
+        sum(t2.wifi_play) as wifiPlay, <!-- 视频-wifi播放 -->
+        sum(t2.play100_feed_break) as play100FeedBreak,  <!-- 视频-播放100%进度总数 -->
+        sum(t2.play75_feed_break) as play75FeedBreak,  <!-- 视频-播放75%进度总数 -->
+        sum(t2.comment) as comment,  <!-- 互动数据-评论数 -->
+        AVG(t2.next_day_open) as nextDayOpen,  <!-- 次留数 -->
+        AVG(t2.next_day_open_rate) as nextDayOpenRate,  <!-- 次留率 -->
+        AVG(t2.next_day_open_cost) as nextDayOpenCost  <!-- 次留成本 -->
+        from
+        ctop_user_allocation t1
+        left join ctop_bytedance_report_creative_daily t2 on t1.account_id = t2.advertiser_id
+        left join ctop_bytedance_creative t3 on t2.creative_id = t3.id
+        left join ctop_bytedance_video_info t4 on t3.video_id = t4.id
+        where t1.id in
+        <foreach item="item" index="index" collection="accountIds"
+                 open="(" separator="," close=")">
+            #{item}
+        </foreach>
+        and
+        <if test="userId != null">
+            and t1.user_id = #{userId,jdbcType=VARCHAR}
+        </if>
+        and t1.media_id = '1'
+        and t1.account_id != ''
+        <if test="startDate != null">
+            and t2.stat_datetime &lt;= #{startDate}
+        </if>
+        <if test="endDate != null">
+            and t2.stat_datetime &gt;= #{endDate} and
+        </if>
+        1=1
+        group by t4.signature
+        order by sum(t2.cost) desc
+        limit 100
+    </select>
+
 
 </mapper>

+ 9 - 0
module-report/src/main/java/cn/com/ctop/bytedance/service/IBytedanceCreativeDailyReportService.java

@@ -1,8 +1,11 @@
 package cn.com.ctop.bytedance.service;
 
 import cn.com.ctop.bytedance.entity.BytedanceCreativeDailyReport;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.service.IService;
 
+import java.util.List;
+
 /**
  * @Description: 广告创意日报表信息
  * @Author: jeecg-boot
@@ -11,4 +14,10 @@ import com.baomidou.mybatisplus.extension.service.IService;
  */
 public interface IBytedanceCreativeDailyReportService extends IService<BytedanceCreativeDailyReport> {
 
+    List<BytedanceCreativeDailyReport> bytedanceCreativeDailyReportList(JSONObject json);
+
+    List<BytedanceCreativeDailyReport> bytedanceCreativeAccountReportList(JSONObject json);
+
+
+
 }

+ 44 - 0
module-report/src/main/java/cn/com/ctop/bytedance/service/impl/BytedanceCreativeDailyReportServiceImpl.java

@@ -2,11 +2,21 @@ package cn.com.ctop.bytedance.service.impl;
 
 import cn.com.ctop.bytedance.entity.BytedanceCreativeDailyReport;
 import cn.com.ctop.bytedance.mapper.BytedanceCreativeDailyReportMapper;
+import cn.com.ctop.bytedance.mapper.MaterialReportMapper;
 import cn.com.ctop.bytedance.service.IBytedanceCreativeDailyReportService;
+import cn.com.ctop.common.module.utils.Check;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.jeecg.common.util.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
 /**
  * @Description: 广告创意日报表信息
  * @Author: jeecg-boot
@@ -15,5 +25,39 @@ import org.springframework.stereotype.Service;
  */
 @Service
 public class BytedanceCreativeDailyReportServiceImpl extends ServiceImpl<BytedanceCreativeDailyReportMapper, BytedanceCreativeDailyReport> implements IBytedanceCreativeDailyReportService {
+    @Autowired
+    private BytedanceCreativeDailyReportMapper bytedanceCreativeDailyReportMapper;
+
+    @Override
+    public List<BytedanceCreativeDailyReport> bytedanceCreativeDailyReportList(JSONObject json) {
+        String userId = json.getString("userId");
+        if (Check.isNull(userId)) {
+            return null;
+        }
+        String nowDate = json.getString("startDate");;
+        String endDate = json.getString("endDate");;
+        Map<String, Object> paramsMap = new HashMap<>();
+        paramsMap.put("userId", userId);
+        paramsMap.put("startDate",nowDate);
+        paramsMap.put("endDate",endDate);
+
+        return bytedanceCreativeDailyReportMapper.bytedanceCreativeDailyReport(paramsMap);
+    }
+
+    @Override
+    public List<BytedanceCreativeDailyReport> bytedanceCreativeAccountReportList(JSONObject json) {
+        Map<String, Object> paramsMap = new HashMap<>();
+        JSONArray accountIds = json.getJSONArray("accountIds");
+        if (Check.isNull(accountIds)) {
+            return null;
+        }
+        paramsMap.put("accountIds", accountIds);
+        String nowDate = json.getString("startDate");;
+        String endDate = json.getString("endDate");;
+        paramsMap.put("startDate",nowDate);
+        paramsMap.put("endDate",endDate);
+
+        return bytedanceCreativeDailyReportMapper.bytedanceCreativeAccountReport(paramsMap);
+    }
 
 }

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

@@ -102,5 +102,9 @@ public interface UserEfficientVideoMapMapper extends BaseMapper<UserEfficientVid
 
     List<String> getUserIdListByDepId(@Param("depId")String depId);
 
+    void updateKuaishouEffiType(@Param("kuaishouEffiType")Integer kuaishouEffiType, @Param("signature")String signature);
+
+    void updateToutiaoEffiType(@Param("toutiaoEffiType")Integer toutiaoEffiType, @Param("signature")String signature);
+
 }
 

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

@@ -697,4 +697,19 @@
         dep_id = #{depId}
     </select>
 
+    <!-- 更新快手的有效视频 -->
+    <select id="updateKuaishouEffiType">
+        update ctop_material_info
+        set kuaishou_effi_type = #{kuaishouEffiType}
+        where code = #{signature}
+    </select>
+
+    <!-- 更新头条的有效视频 -->
+    <select id="updateToutiaoEffiType">
+        update ctop_material_info
+        set toutiao_effi_type = #{toutiaoEffiType}
+        where code = #{signature}
+    </select>
+
+
 </mapper>