Browse Source

视频报表修改

hcst_sunzhen 5 years ago
parent
commit
ede5c98b9f

+ 7 - 7
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/xml/ProjectMemberMapper.xml

@@ -12,12 +12,12 @@
     <!-- 设计师展示所有自己的角色下制作的视频 -->
     <select id="adminProjects" resultType="org.jeecg.modules.ctop.entity.ProjectMember">
         select
-        project_id,
+        id,
         project_name,
         advertiser_id,
         advertiser_name,
         media_id,
-        maxBid,
+        max_bid,
         advertiser_name,
         responsible_name
         from
@@ -29,12 +29,12 @@
     <!-- 视频报表设计师leader展示自己所在公司的所有项目 -->
     <select id="designLeaderProjects" resultType="org.jeecg.modules.ctop.entity.ProjectMember">
         select
-        b.project_id,
+        b.id,
         b.project_name,
         b.advertiser_id,
         b.advertiser_name,
         b.media_id,
-        b.maxBid,
+        b.max_bid,
         b.advertiser_name,
         b.responsible_name
         from
@@ -59,7 +59,7 @@
         from
         ctop_project_member a
         left join ctop_project b on a.project_id = b.id
-        where user_id = #{userId}
+        where a.user_id = #{userId}
         and b.media_id = #{mediaId}
         group by a.project_id
     </select>
@@ -67,12 +67,12 @@
     <!-- 运营和运营负责人展示所在项目视频 -->
     <select id="operationProjects" resultType="org.jeecg.modules.ctop.entity.ProjectMember">
         select
-        b.project_id,
+        b.id,
         b.project_name,
         b.advertiser_id,
         b.advertiser_name,
         b.media_id,
-        b.maxBid,
+        b.max_bid,
         b.advertiser_name,
         b.responsible_name
         from

+ 1 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/ProjectMemberServiceImpl.java

@@ -70,7 +70,7 @@ public class ProjectMemberServiceImpl extends ServiceImpl<ProjectMemberMapper, P
 
         //角色权限判断
         List<ProjectMember> projectMemberList = null;
-        if(roleCode.equals("plan") || roleCode.equals("plane") || roleCode.equals("shot") || roleCode.equals("plane")|| roleCode.equals("planeLeadert")){
+        if(roleCode.equals("plan") || roleCode.equals("clip") || roleCode.equals("shot") || roleCode.equals("plane")|| roleCode.equals("planeLeader")){
             projectMemberList = memberMapper.designProjects(userId, mediaId);
         }else if( roleCode.equals("designTeamLeader")){
             projectMemberList = memberMapper.designLeaderProjects(companyId, mediaId);

+ 1 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/AccountReportMapper.xml

@@ -584,4 +584,5 @@
 
     </select>
 
+
 </mapper>

+ 58 - 16
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/controller/ByteDanceVideoReportDailyController.java

@@ -79,14 +79,33 @@ public class ByteDanceVideoReportDailyController {
 		 return result;
 	 }
 
+	@AutoLog(value = "头条视频账户视频关联方法")
+	@ApiOperation(value = "头条视频账户视频关联方法", notes = "头条视频账户视频关联方法")
+	@PostMapping(value = "/accountVideoMap")
+	public Result accountVideoMap(HttpServletRequest req){
+		Result result = new Result();
+		videoReportDailyService.accountVideoMap();
+		result.setSuccess(true);
+		return result;
+	}
 
 	 @AutoLog(value = "头条视频按天汇总")
 	 @ApiOperation(value = "头条视频按天汇总", notes = "头条视频按天汇总")
 	 @PostMapping(value = "/bytedanceVideoInfoListDaily")
-	 public Result<List<ByteDanceVideoReportDaily>> bytedanceVideoInfoList(@RequestBody DateDTO dateDTO,
+	 public Result<PageInfo<ByteDanceVideoReportDaily>> bytedanceVideoInfoList(@RequestBody DateDTO dateDTO,
 																		   HttpServletRequest req){
-		 Result<List<ByteDanceVideoReportDaily>> result = new Result();
-		 List<ByteDanceVideoReportDaily> list = videoReportDailyService.videoInfoListDaily(dateDTO.getDate(), dateDTO.getDate(), dateDTO.getSignature(), dateDTO.getCost());
+		 Result<PageInfo<ByteDanceVideoReportDaily>> result = new Result();
+
+		 Integer pageNo = dateDTO.getPageNo();
+		 Integer pageSize = dateDTO.getPageSize();
+		 if(pageNo == null){
+			 pageNo = 0;
+		 }
+		 if(pageSize == null){
+			 pageSize = 10;
+		 }
+
+		 PageInfo<ByteDanceVideoReportDaily> list = videoReportDailyService.videoInfoListDaily(dateDTO.getDate(), dateDTO.getDate(), dateDTO.getSignature(), dateDTO.getCost(), pageNo, pageSize, dateDTO.getProjectIds(), dateDTO.getAccountIds());
 
 		 result.setResult(list);
 		 result.setSuccess(true);
@@ -121,8 +140,15 @@ public class ByteDanceVideoReportDailyController {
 	 public Result<PageInfo<ByteDanceVideoReportDaily>> videoInfoListTotal(@RequestBody DateDTO dateDTO,
 																		HttpServletRequest req){
 		 Result<PageInfo<ByteDanceVideoReportDaily>> result = new Result();
-
-		 PageInfo<ByteDanceVideoReportDaily> list = videoReportDailyService.videoInfoListTotal(dateDTO.getStartDate(), dateDTO.getEndDate(), dateDTO.getSignature(), dateDTO.getCost());
+		 Integer pageNo = dateDTO.getPageNo();
+		 Integer pageSize = dateDTO.getPageSize();
+		 if(pageNo == null){
+			 pageNo = 0;
+		 }
+		 if(pageSize == null){
+			 pageSize = 10;
+		 }
+		 PageInfo<ByteDanceVideoReportDaily> list = videoReportDailyService.videoInfoListTotal(dateDTO.getStartDate(), dateDTO.getEndDate(), dateDTO.getSignature(), dateDTO.getCost(), pageNo, pageSize, dateDTO.getProjectIds(), dateDTO.getAccountIds());
 		 result.setResult(list);
 		 result.setSuccess(true);
 		 return result;
@@ -131,14 +157,22 @@ public class ByteDanceVideoReportDailyController {
 	 @AutoLog(value = "头条视频按月汇总")
 	 @ApiOperation(value = "头条视频按月汇总", notes = "头条视频按月汇总")
 	 @PostMapping(value = "/bytedanceVideoInfoListMonth")
-	 public Result<List<ByteDanceVideoReportDaily>> bytedanceVideoInfoListMonth(@RequestBody DateDTO dateDTO,
+	 public Result<PageInfo<ByteDanceVideoReportDaily>> bytedanceVideoInfoListMonth(@RequestBody DateDTO dateDTO,
 																			   HttpServletRequest req){
-		 Result<List<ByteDanceVideoReportDaily>> result = new Result();
+		 Result<PageInfo<ByteDanceVideoReportDaily>> result = new Result();
 
 		 if(StringUtils.isBlank(dateDTO.getSignature())){
 			 dateDTO.setSignature(null);
 		 }
-		 List<ByteDanceVideoReportDaily> list = videoReportDailyService.videoInfoListMonth(dateDTO.getStartDate(), dateDTO.getEndDate(), dateDTO.getSignature(), dateDTO.getCost());
+		 Integer pageNo = dateDTO.getPageNo();
+		 Integer pageSize = dateDTO.getPageSize();
+		 if(pageNo == null){
+			 pageNo = 0;
+		 }
+		 if(pageSize == null){
+			 pageSize = 10;
+		 }
+		 PageInfo<ByteDanceVideoReportDaily> list = videoReportDailyService.videoInfoListMonth(dateDTO.getStartDate(), dateDTO.getEndDate(), dateDTO.getSignature(), dateDTO.getCost(), pageNo, pageSize, dateDTO.getProjectIds(), dateDTO.getAccountIds());
 		 result.setResult(list);
 		 result.setSuccess(true);
 		 return result;
@@ -198,12 +232,12 @@ public class ByteDanceVideoReportDailyController {
 		 result.setSuccess(true);
 		 result.setMessage("success");
 
-		 int perCode = videoReportDailyService.videoInfoListTotalExportExcelPermission();
-		 if(perCode == 0){
-		 	result.setMessage("无导出权限");
-		 	result.setCode(500);
-			return;
-		 }
+		 //int perCode = videoReportDailyService.videoInfoListTotalExportExcelPermission();
+		 //if(perCode == 0){
+		 //	result.setMessage("无导出权限");
+		 //	result.setCode(500);
+			//return;
+		 //}
 
 		 //公司报表
 		 List<ByteDanceVideoReportDaily> list = videoReportDailyService.videoInfoListDetail(dateDTO.getStartDate(), dateDTO.getEndDate(), dateDTO.getSignature());
@@ -214,7 +248,7 @@ public class ByteDanceVideoReportDailyController {
 			 for (ByteDanceVideoReportDaily sum : list) {
 				 List<Object> ByteDanceVideoReportDaily = new ArrayList();
 				 ByteDanceVideoReportDaily.add(sum.getAdvertiserName());  //客户
-				 ByteDanceVideoReportDaily.add(sum.getUrl() );  //视频链接
+				 ByteDanceVideoReportDaily.add(sum.getVideoUrl() );  //视频链接
 				 ByteDanceVideoReportDaily.add(DateUtils.formatDate(sum.getStatDatetime()));  //时间
 				 ByteDanceVideoReportDaily.add(sum.getCost());  //消耗
 				 ByteDanceVideoReportDaily.add(sum.getHuanbi().multiply(new BigDecimal("100")).setScale(2,BigDecimal.ROUND_HALF_UP) + "%");  //环比
@@ -244,6 +278,14 @@ public class ByteDanceVideoReportDailyController {
 		 result.setSuccess(true);
 		 result.setMessage("success");
 
+		 //权限判断
+		 int perCode = videoReportDailyService.videoInfoListTotalExportExcelPermission();
+		 if(perCode == 0){
+			 result.setMessage("无导出权限");
+			 result.setCode(500);
+			 return;
+		 }
+
 		 String[] columns = dateDTO.getColumns();
 
   		 List<ByteDanceVideoReportDaily> list = videoReportDailyService.videoInfoListTotalExcel(dateDTO.getStartDate(), dateDTO.getEndDate(), dateDTO.getSignature(), dateDTO.getCost());
@@ -296,7 +338,7 @@ public class ByteDanceVideoReportDailyController {
 					 }
 
 					 if( column.equals("url")){
-						 ByteDanceVideoReportDaily.add(sum.getUrl() );  //
+						 ByteDanceVideoReportDaily.add(sum.getVideoUrl() );  //下载的时候链接转换成头条的链接
 						 continue;
 					 }
 

+ 7 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/ByteDanceVideoReportDailyMapper.java

@@ -61,4 +61,11 @@ public interface ByteDanceVideoReportDailyMapper extends BaseMapper<ByteDanceVid
     //拍摄
     List<ByteDanceVideoReportDaily> videoInfoListGroupShot(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("companyId")String companyId, @Param("userId")String userId, @Param("accountIds") List<Long> accountIds, @Param("signature") String signature, @Param("cost") BigDecimal cost);
 
+    //运营
+    List<ByteDanceVideoReportDaily> videoInfoListGroupOperator(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("accountIds") List<Long> accountIds, @Param("signature") String signature, @Param("cost") BigDecimal cost);
+
+    List<Long> getAccountIdByprojectIds(@Param("projectIds")List<Long> projectIds);
+
+    List<Long> getAccountIdsByOperatorIdAndMediaId(@Param("mediaId")Integer mediaId, @Param("userId")String userId);
+
 }

+ 168 - 134
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/xml/ByteDanceVideoReportDailyMapper.xml

@@ -361,7 +361,7 @@
         then sum(a.cost) / sum(a.click)
         else 0 end                           as cpc,                            -- 平均点击单价
         -- sum(a.location_click)                    as locationClick,                  -- 互动数据-POI点击数
-        sum(a.play_over_rate)                    as playOverRate,                   -- 视频数据-播完率
+        -- sum(a.play_over_rate)                    as playOverRate,                   -- 视频数据-播完率
 
         case
         when sum(a.show_material) != 0
@@ -459,7 +459,8 @@
         case
         when sum(a.click) != 0
         then sum(a.download_start) / sum(a.click)
-        else 0 end                           as downloadStartRate               --  应用下载广告数据-安卓下载开始率  计算方法:安卓下载开始数/点击数
+        else 0 end                           as downloadStartRate,               --  应用下载广告数据-安卓下载开始率  计算方法:安卓下载开始数/点击数
+        a.huanbi as huanbi
     </sql>
 
      <select id="videoInfoListGroupAdmin" resultType="cn.com.ctop.toutiao.modules.report.entity.ByteDanceVideoReportDaily">
@@ -472,10 +473,10 @@
         and stat_datetime &lt;= #{endDate}
         and f.material_id is not null
         <if test="accountIds != null">
-        and p.account_id in
-        <foreach item="item" index="index" collection="accountIds" open="(" separator="," close=")">
-         #{item}
-        </foreach>
+            and p.account_id in
+                <foreach item="item" index="index" collection="accountIds" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
         </if>
 
         <if test="signature != null and signature != '' ">
@@ -498,12 +499,11 @@
         and stat_datetime &lt;= #{endDate}
         and a.company_id = #{companyId}
         and f.material_id is not null
-
         <if test="accountIds != null">
-        and p.account_id in
-        <foreach item="item" index="index" collection="accountIds" open="(" separator="," close=")">
-            #{item}
-        </foreach>
+            and p.account_id in
+                <foreach item="item" index="index" collection="accountIds" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
         </if>
 
         <if test="signature != null and signature != '' ">
@@ -526,13 +526,12 @@
         and stat_datetime &lt;= #{endDate}
         and a.company_id = #{companyId}
         and f.material_id is not null
-        and f.plane = #{userId}
-        and f.material_id is not null
+        and f.plane_id = #{userId}
         <if test="accountIds != null">
-        and p.account_id in
-        <foreach item="item" index="index" collection="accountIds" open="(" separator="," close=")">
-            #{item}
-        </foreach>
+            and p.account_id in
+                <foreach item="item" index="index" collection="accountIds" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
         </if>
         <if test="signature != null and signature != '' ">
             and a.signature = #{signature}
@@ -554,13 +553,12 @@
         and stat_datetime &lt;= #{endDate}
         and a.company_id = #{companyId}
         and f.material_id is not null
-        and f.plan = #{userId}
-        and f.material_id is not null
+        and f.plan_id = #{userId}
         <if test="accountIds != null">
-        and p.account_id in
-        <foreach item="item" index="index" collection="accountIds" open="(" separator="," close=")">
-            #{item}
-        </foreach>
+            and p.account_id in
+                <foreach item="item" index="index" collection="accountIds" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
         </if>
         <if test="signature != null and signature != '' ">
             and a.signature = #{signature}
@@ -582,12 +580,12 @@
         and stat_datetime &lt;= #{endDate}
         and a.company_id = #{companyId}
         and f.material_id is not null
-        and f.clip = #{userId}
+        and f.clip_id = #{userId}
         <if test="accountIds != null">
-        and p.account_id in
-        <foreach item="item" index="index" collection="accountIds" open="(" separator="," close=")">
-            #{item}
-        </foreach>
+            and p.account_id in
+                <foreach item="item" index="index" collection="accountIds" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
         </if>
         <if test="signature != null and signature != '' ">
             and a.signature = #{signature}
@@ -597,7 +595,7 @@
             having sum(a.cost) &gt;= #{cost}
         </if>
         order by sum(a.cost)
-    </select> <!-- 测试 -->
+    </select>
 
     <select id="videoInfoListGroupShot" resultType="cn.com.ctop.toutiao.modules.report.entity.ByteDanceVideoReportDaily">
         select
@@ -609,13 +607,37 @@
         and stat_datetime &lt;= #{endDate}
         and a.company_id = #{companyId}
         and f.material_id is not null
-        and f.shot = #{userId}
+        and f.shot_id = #{userId}
         <if test="accountIds != null">
+            and p.account_id in
+                <foreach item="item" index="index" collection="accountIds" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+        </if>
+        <if test="signature != null and signature != '' ">
+            and a.signature = #{signature}
+        </if>
+        group by a.signature
+        <if test="cost != null">
+            having sum(a.cost) &gt;= #{cost}
+        </if>
+        order by sum(a.cost)
+    </select>
+
+    <select id="videoInfoListGroupOperator" resultType="cn.com.ctop.toutiao.modules.report.entity.ByteDanceVideoReportDaily">
+        select
+        <include refid="selectSql"></include>
+        from ctop_bytedance_video_report_daily a
+        left join (select material_id from ctop_material_ascription group by material_id) f on a.signature = f.material_id
+        left join ctop_bytedance_account_video_map p on a.signature = p.signature
+        where stat_datetime &gt;= #{startDate}
+        and stat_datetime &lt;= #{endDate}
+        and f.material_id is not null
         and p.account_id in
         <foreach item="item" index="index" collection="accountIds" open="(" separator="," close=")">
             #{item}
         </foreach>
-        </if>
+
         <if test="signature != null and signature != '' ">
             and a.signature = #{signature}
         </if>
@@ -707,6 +729,7 @@
         order by stat_datetime desc
     </select>
 
+   <!--
     <select id="bytedanceVideoInfoList" resultType="cn.com.ctop.toutiao.modules.report.entity.ByteDanceVideoReportDaily">
                     select
                     a.project_id as projectId,
@@ -714,97 +737,97 @@
                     a.advertiser_id as advertiserId,
                     a.advertiser_name as advertiserName,
                     a.stat_datetime as statDatetime,
-                    a.cost as cost,  -- 消耗
+                    a.cost as cost,  &#45;&#45; 消耗
                     a.signature as signature,
                     (select info.url from ctop_material_info info where info.code = a.signature limit 1) as url,
-                    <!--  case when e.material_name is null
+                    &lt;!&ndash;  case when e.material_name is null
                     then '-'
-                    else e.material_name end as materialName, -->
+                    else e.material_name end as materialName, &ndash;&gt;
                     '-' as materialDesc,
                     1 as appType,
-                    a.click as clickMaterial,   -- 点击数
-                    a.play25_feed_break_rate as play25FeedBreakRate,  -- 25%进度播放率
-                    a.play_over_rate as playOverRate,  -- 整体完播率
-                    a.convert_rate as convertRate,  -- 转化率  转化数/点击数*100% !
-                    a.active as active, -- 应用下载-激活
-                    a.download_finish as downloadFinish, -- 应用下载-安卓下载完成
-                    a.download_start as downloadStart, -- 应用下载-安卓下载开始
-                    a.install_finish as installFinish, -- 应用下载-安卓安装完成
-                    a.register as register, -- 应用下载-注册
-                    a.pay_count as payCount, -- 应用下载-付费数
-                    -- a.in_app_uv as inAppUv, -- 应用下载-到达uv
-                    -- a.in_app_detail_uv as inAppDetailUv, -- 应用下载-详情页到站uv
-                    -- a.in_app_cart as inAppCart, -- 应用下载-加入购物车
-                    -- a.in_app_order as inAppOrder, -- 应用下载-提交订单
-                    -- a.in_app_pay as inAppPay, -- 应用下载-付费
-                    -- a.phone as phone, -- 落地页-电话拨打数
-                    a.form as form, --  表单提交数
-                    -- a.map_search as mapSearch, -- 落地页-地图搜索
-                    -- a.button as button, -- 落地页-按钮button
-                    -- a.view_material as viewMaterial, -- 落地页-关键页面浏览
-                    -- a.qq as qq, -- 落地页-QQ咨询数
-                    -- a.lottery as lottery, -- 落地页-抽奖数
-                    -- a.vote as vote, -- 落地页-投票
-                    -- a.redirect as redirect, -- 落地页-页面跳转
-                    -- a.shopping as shopping, -- 落地页-商品购买
-                    -- a.consult as consult, -- 落地页-在线咨询
-                    -- a.wechat as wechat, -- 落地页-微信
-                    -- a.phone_confirm as phoneConfirm, -- 落地页-智能电话确认拨打
-                    -- a.phone_connect as phoneConnect, -- 落地页-智能电话确认接通
-                    -- a.consult_effective as consultEffective, -- 落地页-智能电话有效咨询
-                    a.total_play as totalPlay, -- 视频-总播放
-                    a.valid_play as validPlay, -- 视频-有效播放
-                    a.wifi_play as wifiPlay, -- 视频-wifi播放
-                    a.play25_feed_break as play25FeedBreak, -- 视频-播放25%进度总数
-                    a.play50_feed_break as play50FeedBreak, -- 视频-播放50%进度总数
-                    a.play75_feed_break as play75FeedBreak, -- 视频-播放75%进度总数
-                    a.play100_feed_break as play100FeedBreak, -- 视频-播放100%进度总数
-                    -- a.advanced_creative_phone_click as advancedCreativePhoneClick, -- 附加创意-电话按钮
-                    -- a.advanced_creative_counsel_click as advancedCreativeCounselClick, -- 附加创意-在线咨询
-                    -- a.advanced_creative_form_click as advancedCreativeFormClick, -- 附加创意-表单提交
-                    a.share_material as shareMaterial, -- 互动数据-分享数
-                    -- a.comment_material as commentMaterial, -- 互动数据-评论数
-                    a.follow as follow, -- 互动数据-新增关注数
-                    -- a.home_visited as homeVisited, -- 互动数据-主页访问量
-                    -- a.ies_challenge_click as iesChallengeClick, -- 互动数据-挑战赛查看数
-                    -- a.ies_music_click as iesMusicClick, -- 互动数据-音乐查看数
-                    a.next_day_open as nextDayOpen, -- 次留数
-                    a.next_day_open_rate as nextDayOpenRate, -- 次留率 = 次留数/激活数
-                    a.next_day_open_cost as nextDayOpenCost, -- 次留成本 = 消耗/次留数
-                    a.active_pay_amount as activePayAmount, -- 应用下载广告数据-付费次数
-                    a.valid_play_cost as  validPlayCost, -- 视频数据-有效播放成本  计算公式:总花费/有效播放数,当天数据可能会有波动,次日早8点后稳定。
-                    -- a.advanced_creative_coupon_addition as advancedCreativeCouponAddition, -- 附加创意-附加创意卡券领取
-                    a.convert_material as convertMaterial, -- 转化数据-转化数
-                    a.active_pay_cost as activePayCost, -- 应用下载广告数据-付费成本 = 消耗/付费次数
-                    -- a.download as download, -- 落地页转化数据-下载开始
-                    a.cpc as cpc, -- 平均点击单价
-                    -- a.location_click as locationClick, -- 互动数据-POI点击数
-                    a.play_over_rate as playOverRate, -- 视频数据-播完率
-                    a.ctr as ctr, -- 展现数据-点击率   广告被点击的次数占展示次数的百分比。计算方法:点击数/展示数*100%
-                    a.cpm as  cpm, -- 平均千次展现费用  广告平均每一千次展现所付出的费用,计算公式是:总花费/展示数*1000。
-                    a.wifi_play_rate as wifiPlayRate, -- 视频数据-WiFi播放占比
-                    a.like_material as likeMaterial, -- 互动数据-点赞数
-                    a.active_cost as activeCost, -- 应用下载广告数据-激活成本  计算方式:总花费/激活数。
-                    a.game_addiction_cost as gameAddictionCost, -- 应用下载广告数据-关键行为成本  广告主为每个有APP内关键行为的用户所付出的成本,计算公式是总花费/关键行为数。当天数据可能会有波动,次日早8点后稳定。
-                    a.game_addiction as gameAddiction, -- 应用下载广告数据-关键行为数
-                    a.active_rate as activeRate, -- 应用下载广告数据-激活率   计算方式:激活数/点击数*100%
-                    a.game_addiction_rate as gameAddictionRate, -- 应用下载广告数据-关键行为率  关键行为用户占激活用户的比例
-                    a.active_register_rate as activeRegisterRate, -- 应用下载广告数据-注册率   注册用户占激活用户的比例
-                    a.download_finish_cost as downloadFinishCost, -- 应用下载广告数据-安卓下载完成成本 计算方式:总花费/安卓下载完成数。
-                    a.active_register_cost as activeRegisterCost, -- 应用下载广告数据-注册成本  总花费/注册数,当天数据可能会有波动,次日早8点后稳定。
-                    a.show_material as showMaterial, -- 展现数据-展示数
-                    a.download_finish_rate as downloadFinishRate, -- 应用下载广告数据-安卓下载完成率  计算方式:安卓下载完成数/安卓下载开始数
-                    a.install_finish_rate as installFinishRate, -- 应用下载广告数据-安卓安装完成率  计算方式:安卓安装完成数/安卓下载完成数
-                    -- a.coupon as coupon, -- 落地页转化数据-建站卡券领取
-                    -- a.coupon_single_page as couponSinglePage, -- 落地页转化数据-卡券页领取
-                    a.play_over as playOver, -- 完播数
-                    a.download_start_cost as downloadStartCost, -- 应用下载广告数据-安卓下载开始成本  计算方法:总花费/安卓下载开始数。
-                    -- a.message as message, -- 落地页转化数据-短信咨询  用户点击短信咨询的次数
-                    a.valid_play_rate as validPlayRate, -- 视频数据-有效播放率  有效播放数/展示数
-                    a.average_play_time_per_play as averagePlayTimePerPlay, -- 视频数据-平均单次播放时长
-                    a.convert_cost as convertCost, --  转化数据-转化成本=总花费/转化数
-                    a.install_finish_cost as installFinishCost, --  应用下载广告数据-安卓安装完成成本  计算方式:总花费/安卓安装完成数
-                    a.download_start_rate as downloadStartRate --  应用下载广告数据-安卓下载开始率  计算方法:安卓下载开始数/点击数
+                    a.click as clickMaterial,   &#45;&#45; 点击数
+                    a.play25_feed_break_rate as play25FeedBreakRate,  &#45;&#45; 25%进度播放率
+                    a.play_over_rate as playOverRate,  &#45;&#45; 整体完播率
+                    a.convert_rate as convertRate,  &#45;&#45; 转化率  转化数/点击数*100% !
+                    a.active as active, &#45;&#45; 应用下载-激活
+                    a.download_finish as downloadFinish, &#45;&#45; 应用下载-安卓下载完成
+                    a.download_start as downloadStart, &#45;&#45; 应用下载-安卓下载开始
+                    a.install_finish as installFinish, &#45;&#45; 应用下载-安卓安装完成
+                    a.register as register, &#45;&#45; 应用下载-注册
+                    a.pay_count as payCount, &#45;&#45; 应用下载-付费数
+                    &#45;&#45; a.in_app_uv as inAppUv, &#45;&#45; 应用下载-到达uv
+                    &#45;&#45; a.in_app_detail_uv as inAppDetailUv, &#45;&#45; 应用下载-详情页到站uv
+                    &#45;&#45; a.in_app_cart as inAppCart, &#45;&#45; 应用下载-加入购物车
+                    &#45;&#45; a.in_app_order as inAppOrder, &#45;&#45; 应用下载-提交订单
+                    &#45;&#45; a.in_app_pay as inAppPay, &#45;&#45; 应用下载-付费
+                    &#45;&#45; a.phone as phone, &#45;&#45; 落地页-电话拨打数
+                    a.form as form, &#45;&#45;  表单提交数
+                    &#45;&#45; a.map_search as mapSearch, &#45;&#45; 落地页-地图搜索
+                    &#45;&#45; a.button as button, &#45;&#45; 落地页-按钮button
+                    &#45;&#45; a.view_material as viewMaterial, &#45;&#45; 落地页-关键页面浏览
+                    &#45;&#45; a.qq as qq, &#45;&#45; 落地页-QQ咨询数
+                    &#45;&#45; a.lottery as lottery, &#45;&#45; 落地页-抽奖数
+                    &#45;&#45; a.vote as vote, &#45;&#45; 落地页-投票
+                    &#45;&#45; a.redirect as redirect, &#45;&#45; 落地页-页面跳转
+                    &#45;&#45; a.shopping as shopping, &#45;&#45; 落地页-商品购买
+                    &#45;&#45; a.consult as consult, &#45;&#45; 落地页-在线咨询
+                    &#45;&#45; a.wechat as wechat, &#45;&#45; 落地页-微信
+                    &#45;&#45; a.phone_confirm as phoneConfirm, &#45;&#45; 落地页-智能电话确认拨打
+                    &#45;&#45; a.phone_connect as phoneConnect, &#45;&#45; 落地页-智能电话确认接通
+                    &#45;&#45; a.consult_effective as consultEffective, &#45;&#45; 落地页-智能电话有效咨询
+                    a.total_play as totalPlay, &#45;&#45; 视频-总播放
+                    a.valid_play as validPlay, &#45;&#45; 视频-有效播放
+                    a.wifi_play as wifiPlay, &#45;&#45; 视频-wifi播放
+                    a.play25_feed_break as play25FeedBreak, &#45;&#45; 视频-播放25%进度总数
+                    a.play50_feed_break as play50FeedBreak, &#45;&#45; 视频-播放50%进度总数
+                    a.play75_feed_break as play75FeedBreak, &#45;&#45; 视频-播放75%进度总数
+                    a.play100_feed_break as play100FeedBreak, &#45;&#45; 视频-播放100%进度总数
+                    &#45;&#45; a.advanced_creative_phone_click as advancedCreativePhoneClick, &#45;&#45; 附加创意-电话按钮
+                    &#45;&#45; a.advanced_creative_counsel_click as advancedCreativeCounselClick, &#45;&#45; 附加创意-在线咨询
+                    &#45;&#45; a.advanced_creative_form_click as advancedCreativeFormClick, &#45;&#45; 附加创意-表单提交
+                    a.share_material as shareMaterial, &#45;&#45; 互动数据-分享数
+                    &#45;&#45; a.comment_material as commentMaterial, &#45;&#45; 互动数据-评论数
+                    a.follow as follow, &#45;&#45; 互动数据-新增关注数
+                    &#45;&#45; a.home_visited as homeVisited, &#45;&#45; 互动数据-主页访问量
+                    &#45;&#45; a.ies_challenge_click as iesChallengeClick, &#45;&#45; 互动数据-挑战赛查看数
+                    &#45;&#45; a.ies_music_click as iesMusicClick, &#45;&#45; 互动数据-音乐查看数
+                    a.next_day_open as nextDayOpen, &#45;&#45; 次留数
+                    a.next_day_open_rate as nextDayOpenRate, &#45;&#45; 次留率 = 次留数/激活数
+                    a.next_day_open_cost as nextDayOpenCost, &#45;&#45; 次留成本 = 消耗/次留数
+                    a.active_pay_amount as activePayAmount, &#45;&#45; 应用下载广告数据-付费次数
+                    a.valid_play_cost as  validPlayCost, &#45;&#45; 视频数据-有效播放成本  计算公式:总花费/有效播放数,当天数据可能会有波动,次日早8点后稳定。
+                    &#45;&#45; a.advanced_creative_coupon_addition as advancedCreativeCouponAddition, &#45;&#45; 附加创意-附加创意卡券领取
+                    a.convert_material as convertMaterial, &#45;&#45; 转化数据-转化数
+                    a.active_pay_cost as activePayCost, &#45;&#45; 应用下载广告数据-付费成本 = 消耗/付费次数
+                    &#45;&#45; a.download as download, &#45;&#45; 落地页转化数据-下载开始
+                    a.cpc as cpc, &#45;&#45; 平均点击单价
+                    &#45;&#45; a.location_click as locationClick, &#45;&#45; 互动数据-POI点击数
+                    a.play_over_rate as playOverRate, &#45;&#45; 视频数据-播完率
+                    a.ctr as ctr, &#45;&#45; 展现数据-点击率   广告被点击的次数占展示次数的百分比。计算方法:点击数/展示数*100%
+                    a.cpm as  cpm, &#45;&#45; 平均千次展现费用  广告平均每一千次展现所付出的费用,计算公式是:总花费/展示数*1000。
+                    a.wifi_play_rate as wifiPlayRate, &#45;&#45; 视频数据-WiFi播放占比
+                    a.like_material as likeMaterial, &#45;&#45; 互动数据-点赞数
+                    a.active_cost as activeCost, &#45;&#45; 应用下载广告数据-激活成本  计算方式:总花费/激活数。
+                    a.game_addiction_cost as gameAddictionCost, &#45;&#45; 应用下载广告数据-关键行为成本  广告主为每个有APP内关键行为的用户所付出的成本,计算公式是总花费/关键行为数。当天数据可能会有波动,次日早8点后稳定。
+                    a.game_addiction as gameAddiction, &#45;&#45; 应用下载广告数据-关键行为数
+                    a.active_rate as activeRate, &#45;&#45; 应用下载广告数据-激活率   计算方式:激活数/点击数*100%
+                    a.game_addiction_rate as gameAddictionRate, &#45;&#45; 应用下载广告数据-关键行为率  关键行为用户占激活用户的比例
+                    a.active_register_rate as activeRegisterRate, &#45;&#45; 应用下载广告数据-注册率   注册用户占激活用户的比例
+                    a.download_finish_cost as downloadFinishCost, &#45;&#45; 应用下载广告数据-安卓下载完成成本 计算方式:总花费/安卓下载完成数。
+                    a.active_register_cost as activeRegisterCost, &#45;&#45; 应用下载广告数据-注册成本  总花费/注册数,当天数据可能会有波动,次日早8点后稳定。
+                    a.show_material as showMaterial, &#45;&#45; 展现数据-展示数
+                    a.download_finish_rate as downloadFinishRate, &#45;&#45; 应用下载广告数据-安卓下载完成率  计算方式:安卓下载完成数/安卓下载开始数
+                    a.install_finish_rate as installFinishRate, &#45;&#45; 应用下载广告数据-安卓安装完成率  计算方式:安卓安装完成数/安卓下载完成数
+                    &#45;&#45; a.coupon as coupon, &#45;&#45; 落地页转化数据-建站卡券领取
+                    &#45;&#45; a.coupon_single_page as couponSinglePage, &#45;&#45; 落地页转化数据-卡券页领取
+                    a.play_over as playOver, &#45;&#45; 完播数
+                    a.download_start_cost as downloadStartCost, &#45;&#45; 应用下载广告数据-安卓下载开始成本  计算方法:总花费/安卓下载开始数。
+                    &#45;&#45; a.message as message, &#45;&#45; 落地页转化数据-短信咨询  用户点击短信咨询的次数
+                    a.valid_play_rate as validPlayRate, &#45;&#45; 视频数据-有效播放率  有效播放数/展示数
+                    a.average_play_time_per_play as averagePlayTimePerPlay, &#45;&#45; 视频数据-平均单次播放时长
+                    a.convert_cost as convertCost, &#45;&#45;  转化数据-转化成本=总花费/转化数
+                    a.install_finish_cost as installFinishCost, &#45;&#45;  应用下载广告数据-安卓安装完成成本  计算方式:总花费/安卓安装完成数
+                    a.download_start_rate as downloadStartRate &#45;&#45;  应用下载广告数据-安卓下载开始率  计算方法:安卓下载开始数/点击数
         from ctop_bytedance_video_report_daily a
         left join (select id,code,url,material_name from ctop_material_info group by code) e on a.signature = e.code
         left join (select material_id,clip_id,shot_id,plan_id,plane_id from ctop_material_ascription group by material_id) f on e.id = f.material_id
@@ -814,23 +837,8 @@
             and a.company_id = #{companyId}
         </if>
         and e.code is not null
-        <!--<if test="role == 'plan'">
-            and f.plan = #{userId}
-        </if>
-        <if test="role == 'clip'">
-            and f.clip = #{userId}
-        </if>
-        <if test="role == 'shot' ">
-            and f.shot = #{userId}
-        </if>
-        <if test="role == 'plane' ">
-            and f.plane = #{userId}
-        </if>
-        <if test="role == 'admin' or role == 'designTeamLeader'">
-            and 1=1
-        </if>-->
 
-        <choose>   <!-- 编导、剪辑、拍摄、平面只能查看自己本职工作制作的视频,设计组长和管理员能查看所有的-->
+        <choose>   &lt;!&ndash; 编导、剪辑、拍摄、平面只能查看自己本职工作制作的视频,设计组长和管理员能查看所有的&ndash;&gt;
             <when test="role == 'plan'">
                 and f.plan = #{userId}
             </when>
@@ -857,7 +865,8 @@
         <if test="cost != null">
             and cost &gt;= #{cost}
         </if>
-    </select>
+    </select>-->
+
 
     <select id="accountVideoMap" resultType="cn.com.ctop.toutiao.modules.report.DTO.AccountVideoDTO">
             select
@@ -887,6 +896,31 @@
     </insert>
 
 
+    <select id="getAccountIdByprojectIds" resultType="long">
+        select
+        account_id
+        from
+        ctop_user_allocation
+        where
+        project in
+        <foreach collection="projectIds" item="item" separator=","
+                 open="(" close=")">
+            #{item}
+        </foreach>
+        group by account_id
+    </select>
+
+    <select id="getAccountIdsByOperatorIdAndMediaId" resultType="long">
+        select
+        account_id
+        from
+        ctop_user_allocation
+        where
+        user_id = #{userId}
+        and media_id = #{mediaId}
+    </select>
+
+
 
 
 </mapper>

+ 5 - 3
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/IByteDanceVideoReportDailyService.java

@@ -19,11 +19,11 @@ public interface IByteDanceVideoReportDailyService extends IService<ByteDanceVid
 
     PageInfo<ByteDanceVideoReportDaily> videoInfoListWeek(String startDate, String endDate, String signature, BigDecimal cost, Integer pageNo, Integer pageSize, Long[] projectIds, Long[] accountIds);
 
-    PageInfo<ByteDanceVideoReportDaily> videoInfoListTotal(String startDate, String endDate, String signature, BigDecimal cost);
+    PageInfo<ByteDanceVideoReportDaily> videoInfoListTotal(String startDate, String endDate, String signature, BigDecimal cost, Integer pageNo, Integer pageSize, Long[] projectIds, Long[] accountIds);
 
     List<ByteDanceVideoReportDaily> videoInfoListTotalExcel(String startDate, String endDate, String signature, BigDecimal cost);
 
-    List<ByteDanceVideoReportDaily> videoInfoListMonth(String startDate, String endDate, String signature, BigDecimal cost);
+    PageInfo<ByteDanceVideoReportDaily> videoInfoListMonth(String startDate, String endDate, String signature, BigDecimal cost, Integer pageNo, Integer pageSize, Long[] projectIds, Long[] accountIds);
 
     List<ByteDanceVideoReportDaily> videoInfoListDetail(String startDate, String endDate, String signature);
 
@@ -34,6 +34,8 @@ public interface IByteDanceVideoReportDailyService extends IService<ByteDanceVid
     //excel导出权限
     int videoInfoListTotalExportExcelPermission();
 
-    List<ByteDanceVideoReportDaily> videoInfoListDaily(String startDate, String endDate, String signature, BigDecimal cost);
+    PageInfo<ByteDanceVideoReportDaily> videoInfoListDaily(String startDate, String endDate, String signature, BigDecimal cost, Integer pageNo, Integer pageSize, Long[] projectIds, Long[] accountIds);
+
+    void accountVideoMap();
 
 }

+ 341 - 44
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/ByteDanceVideoReportDailyServiceImpl.java

@@ -17,6 +17,7 @@ import org.springframework.stereotype.Service;
 import java.math.BigDecimal;
 import java.text.ParseException;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
 
 /**
@@ -72,26 +73,191 @@ public class ByteDanceVideoReportDailyServiceImpl extends ServiceImpl<ByteDanceV
     }
 
     //视频按天列表
-    public List<ByteDanceVideoReportDaily> videoInfoListDaily(String startDate, String endDate, String signature, BigDecimal cost){
+    public PageInfo<ByteDanceVideoReportDaily> videoInfoListDaily(String startDate, String endDate, String signature, BigDecimal cost, Integer pageNo, Integer pageSize, Long[] projectIds, Long[] accountIds){
         LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         String userId = sysUser.getId();
         String roleCode = byteDanceVideoReportDailyMapper.getRoleCodeByUserId(userId);
         String companyId = byteDanceVideoReportDailyMapper.getCompanyIdByUserId(userId);
 
-        List<ByteDanceVideoReportDaily> mList = byteDanceVideoReportDailyMapper.videoInfoListWeek(startDate, endDate, roleCode, userId, signature, companyId, cost);
+        List<ByteDanceVideoReportDaily> mList = new ArrayList<>();
+        //admin能看所有视频
+        if(roleCode.equals("admin")){
+            if (accountIds != null && accountIds.length != 0){
+                List<Long> accountIdsList = Arrays.asList(accountIds);
+                PageHelper.startPage(pageNo,pageSize);
+                mList = byteDanceVideoReportDailyMapper.videoInfoListGroupAdmin(startDate, endDate, accountIdsList, signature, cost);
+            }else{
+                PageHelper.startPage(pageNo,pageSize);
+                mList = byteDanceVideoReportDailyMapper.videoInfoListGroupAdmin(startDate, endDate, null, signature, cost);
+            }
+        }else if(roleCode.equals("touTiaoOperationManager") || roleCode.equals("operator") || roleCode.equals("operationAssistant")) {
+            if (accountIds != null && accountIds.length != 0){
+                List<Long> accountIdsList = Arrays.asList(accountIds);
+                PageHelper.startPage(pageNo,pageSize);
+                mList = byteDanceVideoReportDailyMapper.videoInfoListGroupOperator(startDate,endDate,accountIdsList,signature,cost);
+            }else{
+                List<Long> accoutnIds= byteDanceVideoReportDailyMapper.getAccountIdsByOperatorIdAndMediaId(1,userId);
+                PageHelper.startPage(pageNo,pageSize);
+                mList = byteDanceVideoReportDailyMapper.videoInfoListGroupOperator(startDate,endDate,accoutnIds,signature,cost);
+            }
+        }else if(roleCode.equals("shot")){
+            //设计师传入projectIds,根据projectIds解析出accountIdsList
+            if (projectIds != null && projectIds.length != 0){
+                List<Long> projectIdsList = Arrays.asList(projectIds);
+                List<Long> accountIdsList = byteDanceVideoReportDailyMapper.getAccountIdByprojectIds(projectIdsList);
+                if(accountIdsList.size() != 0){
+                    PageHelper.startPage(pageNo,pageSize);
+                    mList = byteDanceVideoReportDailyMapper.videoInfoListGroupShot(startDate, endDate, companyId, userId, accountIdsList, signature, cost);
+                }
+            }else{
+                PageHelper.startPage(pageNo,pageSize);
+                mList = byteDanceVideoReportDailyMapper.videoInfoListGroupShot(startDate, endDate, companyId, userId, null, signature, cost);
+            }
+        }else if(roleCode.equals("plan")){
+            if (projectIds != null && projectIds.length != 0){
+                List<Long> projectIdsList = Arrays.asList(projectIds);
+                List<Long> accountIdsList = byteDanceVideoReportDailyMapper.getAccountIdByprojectIds(projectIdsList);
+                if(accountIdsList.size() != 0){
+                    PageHelper.startPage(pageNo,pageSize);
+                    mList = byteDanceVideoReportDailyMapper.videoInfoListGroupPlan(startDate, endDate, companyId, userId, accountIdsList, signature, cost);
+                }
+            }else{
+                PageHelper.startPage(pageNo,pageSize);
+                mList = byteDanceVideoReportDailyMapper.videoInfoListGroupPlan(startDate, endDate, companyId, userId, null, signature, cost);
+            }
+        }else if(roleCode.equals("plane")){
+            if (projectIds != null && projectIds.length != 0){
+                List<Long> projectIdsList = Arrays.asList(projectIds);
+                List<Long> accountIdsList = byteDanceVideoReportDailyMapper.getAccountIdByprojectIds(projectIdsList);
+                if(accountIdsList.size() != 0){
+                    PageHelper.startPage(pageNo,pageSize);
+                    mList = byteDanceVideoReportDailyMapper.videoInfoListGroupPlaneAndPlaneLeader(startDate, endDate, companyId, userId, accountIdsList, signature, cost);
+                }
+            }else{
+                PageHelper.startPage(pageNo,pageSize);
+                mList = byteDanceVideoReportDailyMapper.videoInfoListGroupPlaneAndPlaneLeader(startDate, endDate, companyId, userId, null, signature, cost);
+            }
+        }else if(roleCode.equals("clip")){
+            if (projectIds != null && projectIds.length != 0){
+                List<Long> projectIdsList = Arrays.asList(projectIds);
+                List<Long> accountIdsList = byteDanceVideoReportDailyMapper.getAccountIdByprojectIds(projectIdsList);
+                if(accountIdsList.size() != 0){
+                    PageHelper.startPage(pageNo,pageSize);
+                    mList = byteDanceVideoReportDailyMapper.videoInfoListGroupClip(startDate, endDate, companyId, userId, accountIdsList, signature, cost);
+                }
+            }else{
+                PageHelper.startPage(pageNo,pageSize);
+                mList = byteDanceVideoReportDailyMapper.videoInfoListGroupClip(startDate, endDate, companyId, userId, null, signature, cost);
+            }
+        }else if(roleCode.equals("designTeamLeader")){
+            if (projectIds != null && projectIds.length != 0){
+                List<Long> projectIdsList = Arrays.asList(projectIds);
+                List<Long> accountIdsList = byteDanceVideoReportDailyMapper.getAccountIdByprojectIds(projectIdsList);
+                if(accountIdsList.size() != 0){
+                    PageHelper.startPage(pageNo,pageSize);
+                    mList = byteDanceVideoReportDailyMapper.videoInfoListGroupdesignTeamLeader(startDate, endDate, companyId, accountIdsList, signature, cost);
+                }
+            }else{
+                PageHelper.startPage(pageNo,pageSize);
+                mList = byteDanceVideoReportDailyMapper.videoInfoListGroupdesignTeamLeader(startDate, endDate, companyId, null, signature, cost);
+            }
+        }
 
-        return mList;
+        PageInfo<ByteDanceVideoReportDaily> pageInfo = new PageInfo<>(mList);
+        return pageInfo;
     }
 
 
     //视频报表月列表
-    public List<ByteDanceVideoReportDaily> videoInfoListMonth(String startDate, String endDate, String signature, BigDecimal cost){
+    public PageInfo<ByteDanceVideoReportDaily> videoInfoListMonth(String startDate, String endDate, String signature, BigDecimal cost, Integer pageNo, Integer pageSize, Long[] projectIds, Long[] accountIds){
         LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         String userId = sysUser.getId();
         String roleCode = byteDanceVideoReportDailyMapper.getRoleCodeByUserId(userId);
         String companyId = byteDanceVideoReportDailyMapper.getCompanyIdByUserId(userId);
 
-        List<ByteDanceVideoReportDaily> mList = byteDanceVideoReportDailyMapper.videoInfoListWeek(startDate, endDate, roleCode, userId, signature, companyId, cost);
+        List<ByteDanceVideoReportDaily> mList = new ArrayList<>();
+        //admin能看所有视频
+        if(roleCode.equals("admin")){
+            if (accountIds != null && accountIds.length != 0){
+                List<Long> accountIdsList = Arrays.asList(accountIds);
+                PageHelper.startPage(pageNo,pageSize);
+                mList = byteDanceVideoReportDailyMapper.videoInfoListGroupAdmin(startDate, endDate, accountIdsList, signature, cost);
+            }else{
+                PageHelper.startPage(pageNo,pageSize);
+                mList = byteDanceVideoReportDailyMapper.videoInfoListGroupAdmin(startDate, endDate, null, signature, cost);
+            }
+        }else if(roleCode.equals("touTiaoOperationManager") || roleCode.equals("operator") || roleCode.equals("operationAssistant")) {
+            if (accountIds != null && accountIds.length != 0){
+                List<Long> accountIdsList = Arrays.asList(accountIds);
+                PageHelper.startPage(pageNo,pageSize);
+                mList = byteDanceVideoReportDailyMapper.videoInfoListGroupOperator(startDate,endDate,accountIdsList,signature,cost);
+            }else{
+                List<Long> accoutnIds= byteDanceVideoReportDailyMapper.getAccountIdsByOperatorIdAndMediaId(1,userId);
+                PageHelper.startPage(pageNo,pageSize);
+                mList = byteDanceVideoReportDailyMapper.videoInfoListGroupOperator(startDate,endDate,accoutnIds,signature,cost);
+            }
+        }else if(roleCode.equals("shot")){
+            //设计师传入projectIds,根据projectIds解析出accountIdsList
+            if (projectIds != null && projectIds.length != 0){
+                List<Long> projectIdsList = Arrays.asList(projectIds);
+                List<Long> accountIdsList = byteDanceVideoReportDailyMapper.getAccountIdByprojectIds(projectIdsList);
+                if(accountIdsList.size() != 0){
+                    PageHelper.startPage(pageNo,pageSize);
+                    mList = byteDanceVideoReportDailyMapper.videoInfoListGroupShot(startDate, endDate, companyId, userId, accountIdsList, signature, cost);
+                }
+            }else{
+                PageHelper.startPage(pageNo,pageSize);
+                mList = byteDanceVideoReportDailyMapper.videoInfoListGroupShot(startDate, endDate, companyId, userId, null, signature, cost);
+            }
+        }else if(roleCode.equals("plan")){
+            if (projectIds != null && projectIds.length != 0){
+                List<Long> projectIdsList = Arrays.asList(projectIds);
+                List<Long> accountIdsList = byteDanceVideoReportDailyMapper.getAccountIdByprojectIds(projectIdsList);
+                if(accountIdsList.size() != 0){
+                    PageHelper.startPage(pageNo,pageSize);
+                    mList = byteDanceVideoReportDailyMapper.videoInfoListGroupPlan(startDate, endDate, companyId, userId, accountIdsList, signature, cost);
+                }
+            }else{
+                PageHelper.startPage(pageNo,pageSize);
+                mList = byteDanceVideoReportDailyMapper.videoInfoListGroupPlan(startDate, endDate, companyId, userId, null, signature, cost);
+            }
+        }else if(roleCode.equals("plane")){
+            if (projectIds != null && projectIds.length != 0){
+                List<Long> projectIdsList = Arrays.asList(projectIds);
+                List<Long> accountIdsList = byteDanceVideoReportDailyMapper.getAccountIdByprojectIds(projectIdsList);
+                if(accountIdsList.size() != 0){
+                    PageHelper.startPage(pageNo,pageSize);
+                    mList = byteDanceVideoReportDailyMapper.videoInfoListGroupPlaneAndPlaneLeader(startDate, endDate, companyId, userId, accountIdsList, signature, cost);
+                }
+            }else{
+                PageHelper.startPage(pageNo,pageSize);
+                mList = byteDanceVideoReportDailyMapper.videoInfoListGroupPlaneAndPlaneLeader(startDate, endDate, companyId, userId, null, signature, cost);
+            }
+        }else if(roleCode.equals("clip")){
+            if (projectIds != null && projectIds.length != 0){
+                List<Long> projectIdsList = Arrays.asList(projectIds);
+                List<Long> accountIdsList = byteDanceVideoReportDailyMapper.getAccountIdByprojectIds(projectIdsList);
+                if(accountIdsList.size() != 0){
+                    PageHelper.startPage(pageNo,pageSize);
+                    mList = byteDanceVideoReportDailyMapper.videoInfoListGroupClip(startDate, endDate, companyId, userId, accountIdsList, signature, cost);
+                }
+            }else{
+                PageHelper.startPage(pageNo,pageSize);
+                mList = byteDanceVideoReportDailyMapper.videoInfoListGroupClip(startDate, endDate, companyId, userId, null, signature, cost);
+            }
+        }else if(roleCode.equals("designTeamLeader")){
+            if (projectIds != null && projectIds.length != 0){
+                List<Long> projectIdsList = Arrays.asList(projectIds);
+                List<Long> accountIdsList = byteDanceVideoReportDailyMapper.getAccountIdByprojectIds(projectIdsList);
+                if(accountIdsList.size() != 0){
+                    PageHelper.startPage(pageNo,pageSize);
+                    mList = byteDanceVideoReportDailyMapper.videoInfoListGroupdesignTeamLeader(startDate, endDate, companyId, accountIdsList, signature, cost);
+                }
+            }else{
+                PageHelper.startPage(pageNo,pageSize);
+                mList = byteDanceVideoReportDailyMapper.videoInfoListGroupdesignTeamLeader(startDate, endDate, companyId, null, signature, cost);
+            }
+        }
 
         //计算环比
         for(ByteDanceVideoReportDaily m:mList){
@@ -114,22 +280,103 @@ public class ByteDanceVideoReportDailyServiceImpl extends ServiceImpl<ByteDanceV
             m.setHuanbi(huanbi);
         }
 
-        return mList;
+        PageInfo<ByteDanceVideoReportDaily> pageInfo = new PageInfo<>(mList);
+        return pageInfo;
     }
 
 
     //视频总报表列表
-    public PageInfo<ByteDanceVideoReportDaily> videoInfoListTotal(String startDate, String endDate, String signature, BigDecimal cost){
+    public PageInfo<ByteDanceVideoReportDaily> videoInfoListTotal(String startDate, String endDate, String signature, BigDecimal cost , Integer pageNo, Integer pageSize, Long[] projectIds, Long[] accountIds){
         LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         String userId = sysUser.getId();
         String roleCode = byteDanceVideoReportDailyMapper.getRoleCodeByUserId(userId);
         String companyId = byteDanceVideoReportDailyMapper.getCompanyIdByUserId(userId);
 
-        PageHelper.startPage(0,10);
-        List<ByteDanceVideoReportDaily> mList = byteDanceVideoReportDailyMapper.videoInfoListWeek(startDate, endDate, roleCode, userId, signature, companyId, cost);
-        PageInfo<ByteDanceVideoReportDaily> pageInfo = new PageInfo<>(mList);
-
+        List<ByteDanceVideoReportDaily> mList = new ArrayList<>();
+        //admin能看所有视频
+        if(roleCode.equals("admin")){
+            if (accountIds != null && accountIds.length != 0){
+                List<Long> accountIdsList = Arrays.asList(accountIds);
+                PageHelper.startPage(pageNo,pageSize);
+                mList = byteDanceVideoReportDailyMapper.videoInfoListGroupAdmin(startDate, endDate, accountIdsList, signature, cost);
+            }else{
+                PageHelper.startPage(pageNo,pageSize);
+                mList = byteDanceVideoReportDailyMapper.videoInfoListGroupAdmin(startDate, endDate, null, signature, cost);
+            }
+        }else if(roleCode.equals("touTiaoOperationManager") || roleCode.equals("operator") || roleCode.equals("operationAssistant")) {
+            if (accountIds != null && accountIds.length != 0){
+                List<Long> accountIdsList = Arrays.asList(accountIds);
+                PageHelper.startPage(pageNo,pageSize);
+                mList = byteDanceVideoReportDailyMapper.videoInfoListGroupOperator(startDate,endDate,accountIdsList,signature,cost);
+            }else{
+                List<Long> accoutnIds= byteDanceVideoReportDailyMapper.getAccountIdsByOperatorIdAndMediaId(1,userId);
+                PageHelper.startPage(pageNo,pageSize);
+                mList = byteDanceVideoReportDailyMapper.videoInfoListGroupOperator(startDate,endDate,accoutnIds,signature,cost);
+            }
+        }else if(roleCode.equals("shot")){
+            //设计师传入projectIds,根据projectIds解析出accountIdsList
+            if (projectIds != null && projectIds.length != 0){
+                List<Long> projectIdsList = Arrays.asList(projectIds);
+                List<Long> accountIdsList = byteDanceVideoReportDailyMapper.getAccountIdByprojectIds(projectIdsList);
+                if(accountIdsList.size() != 0){
+                    PageHelper.startPage(pageNo,pageSize);
+                    mList = byteDanceVideoReportDailyMapper.videoInfoListGroupShot(startDate, endDate, companyId, userId, accountIdsList, signature, cost);
+                }
+            }else{
+                PageHelper.startPage(pageNo,pageSize);
+                mList = byteDanceVideoReportDailyMapper.videoInfoListGroupShot(startDate, endDate, companyId, userId, null, signature, cost);
+            }
+        }else if(roleCode.equals("plan")){
+            if (projectIds != null && projectIds.length != 0){
+                List<Long> projectIdsList = Arrays.asList(projectIds);
+                List<Long> accountIdsList = byteDanceVideoReportDailyMapper.getAccountIdByprojectIds(projectIdsList);
+                if(accountIdsList.size() != 0){
+                    PageHelper.startPage(pageNo,pageSize);
+                    mList = byteDanceVideoReportDailyMapper.videoInfoListGroupPlan(startDate, endDate, companyId, userId, accountIdsList, signature, cost);
+                }
+            }else{
+                PageHelper.startPage(pageNo,pageSize);
+                mList = byteDanceVideoReportDailyMapper.videoInfoListGroupPlan(startDate, endDate, companyId, userId, null, signature, cost);
+            }
+        }else if(roleCode.equals("plane")){
+            if (projectIds != null && projectIds.length != 0){
+                List<Long> projectIdsList = Arrays.asList(projectIds);
+                List<Long> accountIdsList = byteDanceVideoReportDailyMapper.getAccountIdByprojectIds(projectIdsList);
+                if(accountIdsList.size() != 0){
+                    PageHelper.startPage(pageNo,pageSize);
+                    mList = byteDanceVideoReportDailyMapper.videoInfoListGroupPlaneAndPlaneLeader(startDate, endDate, companyId, userId, accountIdsList, signature, cost);
+                }
+            }else{
+                PageHelper.startPage(pageNo,pageSize);
+                mList = byteDanceVideoReportDailyMapper.videoInfoListGroupPlaneAndPlaneLeader(startDate, endDate, companyId, userId, null, signature, cost);
+            }
+        }else if(roleCode.equals("clip")){
+            if (projectIds != null && projectIds.length != 0){
+                List<Long> projectIdsList = Arrays.asList(projectIds);
+                List<Long> accountIdsList = byteDanceVideoReportDailyMapper.getAccountIdByprojectIds(projectIdsList);
+                if(accountIdsList.size() != 0){
+                    PageHelper.startPage(pageNo,pageSize);
+                    mList = byteDanceVideoReportDailyMapper.videoInfoListGroupClip(startDate, endDate, companyId, userId, accountIdsList, signature, cost);
+                }
+            }else{
+                PageHelper.startPage(pageNo,pageSize);
+                mList = byteDanceVideoReportDailyMapper.videoInfoListGroupClip(startDate, endDate, companyId, userId, null, signature, cost);
+            }
+        }else if(roleCode.equals("designTeamLeader")){
+            if (projectIds != null && projectIds.length != 0){
+                List<Long> projectIdsList = Arrays.asList(projectIds);
+                List<Long> accountIdsList = byteDanceVideoReportDailyMapper.getAccountIdByprojectIds(projectIdsList);
+                if(accountIdsList.size() != 0){
+                PageHelper.startPage(pageNo,pageSize);
+                mList = byteDanceVideoReportDailyMapper.videoInfoListGroupdesignTeamLeader(startDate, endDate, companyId, accountIdsList, signature, cost);
+                }
+            }else{
+                PageHelper.startPage(pageNo,pageSize);
+                mList = byteDanceVideoReportDailyMapper.videoInfoListGroupdesignTeamLeader(startDate, endDate, companyId, null, signature, cost);
+            }
+        }
 
+        PageInfo<ByteDanceVideoReportDaily> pageInfo = new PageInfo<>(mList);
         return pageInfo;
     }
 
@@ -145,51 +392,100 @@ public class ByteDanceVideoReportDailyServiceImpl extends ServiceImpl<ByteDanceV
         return mList;
     }
 
-    //视频报表列表
+    //视频报表列表
     public PageInfo<ByteDanceVideoReportDaily> videoInfoListWeek(String startDate, String endDate, String signature, BigDecimal cost, Integer pageNo, Integer pageSize, Long[] projectIds, Long[] accountIds){
         LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         String userId = sysUser.getId();
         String roleCode = byteDanceVideoReportDailyMapper.getRoleCodeByUserId(userId);
         String companyId = byteDanceVideoReportDailyMapper.getCompanyIdByUserId(userId);
 
-        //QueryWrapper<ByteDanceVideoReportDaily> wrapper = new QueryWrapper<>();
-        //wrapper.eq("stat_datetime",startDate);
-        //byteDanceVideoReportDailyMapper.delete(wrapper);
         List<ByteDanceVideoReportDaily> mList = new ArrayList<>();
         //PageHelper.startPage(pageNo,pageSize);
-        PageHelper.startPage(0,10);
-        mList = byteDanceVideoReportDailyMapper.videoInfoListWeek(startDate, endDate, roleCode, userId, signature, companyId, cost);
-        //PageInfo<ByteDanceVideoReportDaily> pageInfo =
-
-        //PageInfo<ByteDanceVideoReportDaily> pageInfo = new PageInfo<>(dailyList);
-        //result.put("data", pageInfo);
+        //mList = byteDanceVideoReportDailyMapper.videoInfoListWeek(startDate, endDate, roleCode, userId, signature, companyId, cost);
 
         //admin能看所有视频
-        if(roleCode == "admin"){
-
-
-
-        }else if(roleCode == "touTiaoOperationManager" || roleCode == "operator" || roleCode == "operationAssistant") {
-
-
-        }else if(roleCode == "shot"){
-
-
-        }else if(roleCode == "plan"){
-
-
-        }else if(roleCode == "plane"){
-
-
-        }else if(roleCode == "clip"){
-
-
-        }else if(roleCode == "designTeamLeader"){
-
-
+        if(roleCode.equals("admin")){
+            if (accountIds != null && accountIds.length != 0){
+                List<Long> accountIdsList = Arrays.asList(accountIds);
+                PageHelper.startPage(pageNo,pageSize);
+                mList = byteDanceVideoReportDailyMapper.videoInfoListGroupAdmin(startDate, endDate, accountIdsList, signature, cost);
+            }else{
+                PageHelper.startPage(pageNo,pageSize);
+                mList = byteDanceVideoReportDailyMapper.videoInfoListGroupAdmin(startDate, endDate, null, signature, cost);
+            }
+        }else if(roleCode.equals("touTiaoOperationManager") || roleCode.equals("operator") || roleCode.equals("operationAssistant")) {
+            if (accountIds != null && accountIds.length != 0){
+                List<Long> accountIdsList = Arrays.asList(accountIds);
+                PageHelper.startPage(pageNo,pageSize);
+                mList = byteDanceVideoReportDailyMapper.videoInfoListGroupOperator(startDate,endDate,accountIdsList,signature,cost);
+            }else{
+                List<Long> accoutnIds= byteDanceVideoReportDailyMapper.getAccountIdsByOperatorIdAndMediaId(1,userId);
+                PageHelper.startPage(pageNo,pageSize);
+                mList = byteDanceVideoReportDailyMapper.videoInfoListGroupOperator(startDate,endDate,accoutnIds,signature,cost);
+            }
+        }else if(roleCode.equals("shot")){
+            //设计师传入projectIds,根据projectIds解析出accountIdsList
+            if (projectIds != null && projectIds.length != 0){
+                List<Long> projectIdsList = Arrays.asList(projectIds);
+                List<Long> accountIdsList = byteDanceVideoReportDailyMapper.getAccountIdByprojectIds(projectIdsList);
+                if(accountIdsList.size() != 0){
+                    PageHelper.startPage(pageNo,pageSize);
+                    mList = byteDanceVideoReportDailyMapper.videoInfoListGroupShot(startDate, endDate, companyId, userId, accountIdsList, signature, cost);
+                }
+            }else{
+                PageHelper.startPage(pageNo,pageSize);
+                mList = byteDanceVideoReportDailyMapper.videoInfoListGroupShot(startDate, endDate, companyId, userId, null, signature, cost);
+            }
+        }else if(roleCode.equals("plan")){
+            if (projectIds != null && projectIds.length != 0){
+                List<Long> projectIdsList = Arrays.asList(projectIds);
+                List<Long> accountIdsList = byteDanceVideoReportDailyMapper.getAccountIdByprojectIds(projectIdsList);
+                if(accountIdsList.size() != 0){
+                    PageHelper.startPage(pageNo,pageSize);
+                    mList = byteDanceVideoReportDailyMapper.videoInfoListGroupPlan(startDate, endDate, companyId, userId, accountIdsList, signature, cost);
+                }
+            }else{
+                PageHelper.startPage(pageNo,pageSize);
+                mList = byteDanceVideoReportDailyMapper.videoInfoListGroupPlan(startDate, endDate, companyId, userId, null, signature, cost);
+            }
+        }else if(roleCode.equals("plane")){
+            if (projectIds != null && projectIds.length != 0){
+                List<Long> projectIdsList = Arrays.asList(projectIds);
+                List<Long> accountIdsList = byteDanceVideoReportDailyMapper.getAccountIdByprojectIds(projectIdsList);
+                if(accountIdsList.size() != 0){
+                    PageHelper.startPage(pageNo,pageSize);
+                    mList = byteDanceVideoReportDailyMapper.videoInfoListGroupPlaneAndPlaneLeader(startDate, endDate, companyId, userId, accountIdsList, signature, cost);
+                }
+            }else{
+                PageHelper.startPage(pageNo,pageSize);
+                mList = byteDanceVideoReportDailyMapper.videoInfoListGroupPlaneAndPlaneLeader(startDate, endDate, companyId, userId, null, signature, cost);
+            }
+        }else if(roleCode.equals("clip")){
+            if (projectIds != null && projectIds.length != 0){
+                List<Long> projectIdsList = Arrays.asList(projectIds);
+                List<Long> accountIdsList = byteDanceVideoReportDailyMapper.getAccountIdByprojectIds(projectIdsList);
+                if(accountIdsList.size() != 0){
+                    PageHelper.startPage(pageNo,pageSize);
+                    mList = byteDanceVideoReportDailyMapper.videoInfoListGroupClip(startDate, endDate, companyId, userId, accountIdsList, signature, cost);
+                }
+            }else{
+                PageHelper.startPage(pageNo,pageSize);
+                mList = byteDanceVideoReportDailyMapper.videoInfoListGroupClip(startDate, endDate, companyId, userId, null, signature, cost);
+            }
+        }else if(roleCode.equals("designTeamLeader")){
+            if (projectIds != null && projectIds.length != 0){
+                List<Long> projectIdsList = Arrays.asList(projectIds);
+                List<Long> accountIdsList = byteDanceVideoReportDailyMapper.getAccountIdByprojectIds(projectIdsList);
+                if(accountIdsList.size() != 0){
+                    PageHelper.startPage(pageNo,pageSize);
+                    mList = byteDanceVideoReportDailyMapper.videoInfoListGroupdesignTeamLeader(startDate, endDate, companyId, accountIdsList, signature, cost);
+                }
+            }else{
+                PageHelper.startPage(pageNo,pageSize);
+                mList = byteDanceVideoReportDailyMapper.videoInfoListGroupdesignTeamLeader(startDate, endDate, companyId, null, signature, cost);
+            }
         }
 
-
         //计算环比
         for(ByteDanceVideoReportDaily m:mList){
             String startWeekDate  = DateUtils.formatDate(DateUtils.addDay(DateUtils.getDate(startDate),-1));
@@ -250,6 +546,7 @@ public class ByteDanceVideoReportDailyServiceImpl extends ServiceImpl<ByteDanceV
 
     public void accountVideoMap(){
         List<AccountVideoDTO> accountVideoDTOList = byteDanceVideoReportDailyMapper.accountVideoMap();
+        byteDanceVideoReportDailyMapper.replaceIntoAccountVideoMapBatch(accountVideoDTOList);
     }
 
 }